/** * @return \Fusio\Engine\Context */ protected function getContext() { $app = new App(); $app->setAnonymous(false); $app->setId(3); $app->setUserId(2); $app->setStatus(1); $app->setName('Foo-App'); $app->setUrl('http://google.com'); $app->setParameters(['foo' => 'bar']); $app->setScopes(['foo', 'bar']); $app->setAppKey('5347307d-d801-4075-9aaa-a21a29a448c5'); $user = new User(); $user->setAnonymous(false); $user->setId(2); $user->setStatus(0); $user->setName('Consumer'); $action = new Action(); $action->setId(uniqid()); $action->setName('foo'); $action->setDate(date('Y-m-d H:i:s')); return new Context(34, $app, $user, $action); }
protected function newAction(array $row) { $config = !empty($row['config']) ? unserialize($row['config']) : []; $action = new Action(); $action->setId($row['id']); $action->setName($row['name']); $action->setClass($row['class']); $action->setConfig($config); $action->setDate($row['date']); return $action; }
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); }