/** * Actionを実行 * * @return string viewのパス */ private function executeAction() { // 現在のアクションを取得 $action = $this->getCurAction(); if (!is_object($action)) { throw new Teeple_Exception("Actionオブジェクトが取得できません。"); } $className = get_class($action); $this->log->info("アクション {$className} を実行します。"); // メソッド名 $methodName = $this->request->getActionMethod(); if (!method_exists($action, $methodName)) { $methodName = 'execute'; } // Converterの実行 $params = $this->request->getParameters(); $this->doConverter($action, $params); // Requestの値をActionに移す if (count($params) > 0) { foreach ($params as $name => $value) { if (preg_match('/^__/', $name)) { continue; } $action->{$name} = $params[$name]; } } if (!$this->request->isFilterError()) { // Validatorの実行 $this->doValidation($action, $methodName); } // エラーが発生している場合は、onXXError()メソッドを実行する。 if ($this->request->isFilterError()) { $type = $this->request->getFilterError(); $this->log->debug("errortype: {$type}"); if ($type != "") { $methodName = 'on' . $type . 'Error'; $this->log->info("メソッド {$methodName} を実行します。"); if (method_exists($action, $methodName)) { return $action->{$methodName}(); } $this->log->warn("メソッド {$methodName} が存在しません。"); return NULL; } } // Actionメソッドを実行する。 $this->log->info("メソッド {$methodName} を実行します。"); return $action->{$methodName}(); }