/** * Analiza nuestro workspace, lee los controllers, sus actions, las agrega a la base de datos */ public function analizeWorkspace() { foreach (array_keys($this->controllers) as $baseControllerName) { $controllerName = $this->underscore(substr($baseControllerName, 0, -10)); $controller = Query\SecurityControllerQuery::create()->whereAdd(Bean\SecurityController::NAME, $controllerName)->findOne(); if (!$controller instanceof Bean\SecurityController) { $controller = Factory\SecurityControllerFactory::createFromArray(array('name' => $controllerName)); $this->securityControllerCatalog->create($controller); } foreach ($this->getActionsByController($baseControllerName) as $actionName) { $actionName = $this->underscore(substr($actionName, 0, -6)); $action = Query\SecurityActionQuery::create()->whereAdd(Bean\SecurityAction::NAME, $actionName)->whereAdd(Bean\SecurityAction::ID_CONTROLLER, $controller->getIdController())->setLimit(1)->findOne(); if (!$action instanceof Bean\SecurityAction) { $action = Factory\SecurityActionFactory::createFromArray(array('name' => $actionName, 'id_controller' => $controller->getIdController())); $this->securityActionCatalog->create($action); } } } }
/** * * makeBean * @param array $resultset * @return \Application\Model\Bean\SecurityController */ protected function makeBean($resultset) { return SecurityControllerFactory::createFromArray($resultset); }