Esempio n. 1
0
 /**
  * 完成模板渲染,并输出
  */
 public function after()
 {
     if ($this->autoRender) {
         Base::getLog()->debug(__METHOD__ . ' render template view');
         $this->response->body = $this->template->render();
     }
     parent::after();
 }
Esempio n. 2
0
 /**
  * @inheritdoc
  */
 public function executeAction()
 {
     // 继续执行
     parent::executeAction();
     Base::getLog()->debug(__METHOD__ . ' render json content type', ['type' => $this->contentType]);
     $this->response->headers('content-type', $this->contentType);
     $this->response->body = json_encode($this->actionResult);
 }
Esempio n. 3
0
 /**
  * {@inheritdoc}
  */
 public function prepareActionList()
 {
     $actions = parent::prepareActionList();
     Base::getLog()->debug(__METHOD__ . ' handle rest controller request', ['method' => $this->request->method]);
     if (isset($this->methodMapping[$this->request->method])) {
         $action = $this->methodMapping[$this->request->method];
         Base::getLog()->debug(__METHOD__ . ' found rest action', ['method' => $this->request->method, 'action' => $action]);
         $actions[] = $action;
     }
     Base::getLog()->debug(__METHOD__ . ' generate final rest action list', ['actions' => $actions]);
     return $actions;
 }