2016-02-27 57 views
2

我跟隨this official tutorial去學習框架版本2.0.9Phalcon PHP調度程序轉發不起作用

我有一個在PollController下面的代碼應該重定向或增量number_votes後轉發給showAction如下voteAction

public function voteAction($optionId) 
{ 
    $option = PollOptions::findFirstById($optionId); 
    $option->number_votes++; 
    $option->save(); 
    return $this->dispatcher->forward([     
     'action' => 'show', 
     'params' => [$option->poll_id] 
    ]); 
} 

然而,投票的我有poll/vote/xx沒有poll/show/yy其中xx是後選項id和yy分別是

我試圖添加'controller' => 'poll'並用array()替換[]數組定義,但沒有任何結果。然而,當我使用無效或找不到動作名稱爲重點,例如showActionblahaction它返回以下錯誤:

Action 'showAcyoimn' was not found on handler 'poll' 
#0 [internal function]: Phalcon\Mvc\Dispatcher->_throwDispatchException('Action 'showAcy...', 5) 
#1 [internal function]: Phalcon\Dispatcher->dispatch() 
#2 C:\xampp\htdocs\blog\public\index.php(29): Phalcon\Mvc\Application->handle() 
#3 {main} 

回答