コード例 #1
0
ファイル: Options.php プロジェクト: codemix/restyii
 /**
  * Perform the action on a collection of items.
  *
  * @param array $actions the list of existing actions
  * @param ActiveRecord $model the model to perform the action on
  *
  * @return array an array of parameters to send to the `respond()` method
  */
 protected function performCollection($actions, ActiveRecord $model)
 {
     $model->setScenario('create');
     $itemActions = array();
     $collectionActions = array();
     foreach ($actions as $name => $action) {
         if ($action instanceof MultipleTargetInterface) {
             $collectionActions[$name] = $this->prepareAction($action);
         } else {
             if ($action instanceof SingleTargetInterface) {
                 $itemActions[$name] = $this->prepareAction($action);
             } else {
                 unset($actions[$name]);
             }
         }
     }
     $attributes = $this->getAttributeConfigs($model);
     return array(200, array('label' => $model->classLabel(), 'collectionLabel' => $model->classLabel(true), 'attributes' => $attributes, 'itemActions' => $itemActions, 'collectionActions' => $collectionActions));
 }
コード例 #2
0
ファイル: Head.php プロジェクト: codemix/restyii
 /**
  * Perform the action on a collection of items.
  *
  * @param array $actions the list of existing actions
  * @param ActiveRecord $model the model to perform the action on
  *
  * @return array an array of parameters to send to the `respond()` method
  */
 protected function performCollection($actions, ActiveRecord $model)
 {
     $model->setScenario('create');
     foreach ($actions as $name => $action) {
         if (!$action instanceof \Restyii\Action\Collection\Base) {
             unset($actions[$name]);
         } else {
             $actions[$name] = $this->prepareAction($action);
         }
     }
     $attributes = $this->getAttributeConfigs($model);
     return array(200, array('label' => $model->classLabel(true), 'attributes' => $attributes, 'actions' => $actions));
 }