Ejemplo n.º 1
0
 /**
  * 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);
             }
         }
     }
 }
Ejemplo n.º 2
0
 /**
  *
  * makeBean
  * @param array $resultset
  * @return \Application\Model\Bean\SecurityAction
  */
 protected function makeBean($resultset)
 {
     return SecurityActionFactory::createFromArray($resultset);
 }