protected function getDependingActionsByAction($actionId) { $action = $this->actionTable->get($actionId); $config = $action->config; $form = $this->actionParser->getForm($action->class); $actions = []; if ($form instanceof Form\Container) { $elements = $form->getElements(); foreach ($elements as $element) { if ($element instanceof Form\Element\Action) { $name = $element->getName(); if (isset($config[$name]) && is_int($config[$name])) { $actions[] = $config[$name]; $actions = array_merge($actions, $this->getDependingActionsByAction($config[$name])); } } } } return array_unique($actions); }
protected function buildRepository($actionId, Repository\ActionInterface $repository) { $action = $this->actionTable->get($actionId); $config = $action->config; $form = $this->actionParser->getForm($action->class); if ($form instanceof Form\Container) { $elements = $form->getElements(); foreach ($elements as $element) { if ($element instanceof Form\Element\Action) { $name = $element->getName(); if (isset($config[$name]) && $config[$name] > 0) { $this->buildRepository($config[$name], $repository); } } } } $entry = new Model\Action(); $entry->setId($action['id']); $entry->setName($action['name']); $entry->setClass($action['class']); $entry->setConfig($action['config']); $entry->setDate($action['date']->format('Y-m-d H:i:s')); $repository->add($entry); }