Beispiel #1
0
 /**
  * Returns the schema of the output part of an action
  *
  * @param ControllerDefinition $controller
  * @param ActionDefinition $action
  * @return array
  */
 public function getActionOutputSchema(ControllerDefinition $controller, ActionDefinition $action)
 {
     $json = array('type' => $action->getReturnType(), 'flow' => $action->getFlow());
     if (!in_array($action->getFlow(), array(ActionDefinition::FLOW_NONE, ActionDefinition::FLOW_DELEGATE))) {
         $json['next_action'] = $action->getNextAction();
     }
     $limitedSchemaActions = array(ActionDefinition::RETURN_NONE, ActionDefinition::RETURN_REDIRECT, ActionDefinition::RETURN_FILE, ActionDefinition::RETURN_DYNAMIC, ActionDefinition::RETURN_BUILDER);
     if (in_array($action->getReturnType(), $limitedSchemaActions)) {
         return $json;
     }
     $json['behaviors'] = $this->getBehaviorsSchema($controller, $action);
     if (($model = $action->getReturnModel()) !== null) {
         $json['actions'] = $this->getActionActionsSchema($controller, $action, $model);
         $json['model_name'] = $model->getName();
         $json['model_repr'] = $model->getStringReprField()->getProperty();
         $json['fields'] = $this->getFieldsSchema($model->getPublicFields());
     }
     return $json;
 }