| 1: | <?php |
| 2: | |
| 3: | declare(strict_types=1); |
| 4: | |
| 5: | namespace Atk4\Ui\UserAction; |
| 6: | |
| 7: | use Atk4\Data\Model; |
| 8: | use Atk4\Ui\View; |
| 9: | |
| 10: | |
| 11: | |
| 12: | |
| 13: | |
| 14: | class SharedExecutorsContainer extends View |
| 15: | { |
| 16: | |
| 17: | public array $sharedExecutors = []; |
| 18: | |
| 19: | public function getExecutor(Model\UserAction $action): SharedExecutor |
| 20: | { |
| 21: | $action->getOwner()->assertIsModel(); |
| 22: | $this->getOwner()->model->assertIsModel($action->getModel()); |
| 23: | |
| 24: | if (!isset($this->sharedExecutors[$action->shortName])) { |
| 25: | $ex = $this->getExecutorFactory()->createExecutor($action, $this); |
| 26: | $ex->executeModelAction(); |
| 27: | $this->sharedExecutors[$action->shortName] = new SharedExecutor($ex); |
| 28: | } |
| 29: | |
| 30: | return $this->sharedExecutors[$action->shortName]; |
| 31: | } |
| 32: | } |
| 33: | |