/** * 完成模板渲染,并输出 */ public function after() { if ($this->autoRender) { Base::getLog()->debug(__METHOD__ . ' render template view'); $this->response->body = $this->template->render(); } parent::after(); }
/** * @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); }
/** * {@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; }