Beispiel #1
0
 /**
  * Returns the schema for model actions
  *
  * @param ControllerDefinition $controller
  * @param ActionDefinition $action
  * @param ModelDefinition $model
  */
 public function getActionActionsSchema(ControllerDefinition $controller, ActionDefinition $action, ModelDefinition $model)
 {
     $self = $this;
     $controllerActions = $controller->getActionsForModel($model->getClassName());
     $modelActions = array();
     foreach ($model->getActions() as $a) {
         if ($a->isAppliedToModel()) {
             $modelActions[] = $a;
         } else {
             $controllerActions[] = $a;
         }
     }
     return array_merge(array_values(array_filter(array_map(function ($modelAction) use($controller, $action, $self) {
         if (!$self->accessControl->checkPermissions($modelAction->getPermissions())) {
             return false;
         }
         return array_merge($self->getLimitedActionSchema($modelAction), array('behaviors' => $self->getBehaviorsSchema($controller, $modelAction), 'name' => $action->getName() . '/' . $modelAction->getName(), 'controller' => $controller->getName(), 'url' => $self->routing->generate('dashboard.invokeModel', array('controllerName' => $controller->getName(), 'actionName' => $action->getName(), 'modelActionName' => $modelAction->getName()))));
     }, $modelActions))), array_values(array_filter(array_map(function ($action) use($controller, $self) {
         if (!$self->accessControl->checkPermissions($action->getPermissions())) {
             return false;
         }
         return array_merge($self->getLimitedActionSchema($action), array('behaviors' => $self->getBehaviorsSchema($controller, $action), 'controller' => $controller->getName(), 'url' => $self->routing->generate('dashboard.invoke', array('controllerName' => $controller->getName(), 'actionName' => $action->getName()))));
     }, $controllerActions))));
 }