Witajcie,

ZF 1.12
Oto mój (jak zwykle banalny) problem:

app.ini
  1. resources.router.routes.liga.route = "/liga/:l/:s"
  2. resources.router.routes.liga.defaults.controller = "statystyki"
  3. resources.router.routes.liga.defaults.action = "liga"


kontroler
  1. $this->_helper->redirector->gotoRoute(
  2. array('l' => $values['league'],
  3. 's' => $values['season']
  4. ), 'liga'
  5. );



po przekierowaniu na akcję liga, otrzymuję adres np: liga/polska/2013
ALE parametry l i s nie są ustawione, więc nie mogę z nich skorzystać.

Co robię źle? sad.gif


edit: mogę uzyskać dostęp od parametrów
  1. $this->getRequest()->getParam('l')

ale otrzymuję komunikat
Cytat
Exception information:
Message: l is not specified


dorzucam stack trace
Cytat
#0 C:\ZendFramework\library\Zend\Controller\Router\Rewrite.php(470): Zend_Controller_Router_Route->assemble(Array, true, true)
#1 C:\ZendFramework\library\Zend\View\Helper\Url.php(49): Zend_Controller_Router_Rewrite->assemble(Array, NULL, true, true)
#2 [internal function]: Zend_View_Helper_Url->url(Array, NULL, true)
#3 C:\ZendFramework\library\Zend\View\Abstract.php(350): call_user_func_array(Array, Array)
#4 C:\wamp\www\STATY_ZF\application\views\scripts\statystyki\liga.phtml(19): Zend_View_Abstract->__call('url', Array)
#5 C:\wamp\www\STATY_ZF\application\views\scripts\statystyki\liga.phtml(19): Zend_View->url(Array, NULL, true)
#6 C:\ZendFramework\library\Zend\View.php(108): include('C:\wamp\www\STA...')
#7 C:\ZendFramework\library\Zend\View\Abstract.php(888): Zend_View->_run('C:/wamp/www/STA...')
#8 C:\ZendFramework\library\Zend\Controller\Action\Helper\ViewRenderer.php(900): Zend_View_Abstract->render('statystyki/liga...')
#9 C:\ZendFramework\library\Zend\Controller\Action\Helper\ViewRenderer.php(921): Zend_Controller_Action_Helper_ViewRenderer->renderScript('statystyki/liga...', NULL)
#10 C:\ZendFramework\library\Zend\Controller\Action\Helper\ViewRenderer.php(960): Zend_Controller_Action_Helper_ViewRenderer->render()
#11 C:\ZendFramework\library\Zend\Controller\Action\HelperBroker.php(277): Zend_Controller_Action_Helper_ViewRenderer->postDispatch()
#12 C:\ZendFramework\library\Zend\Controller\Action.php(527): Zend_Controller_Action_HelperBroker->notifyPostDispatch()
#13 C:\ZendFramework\library\Zend\Controller\Dispatcher\Standard.php(308): Zend_Controller_Action->dispatch('ligaAction')
#14 C:\ZendFramework\library\Zend\Controller\Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#15 C:\ZendFramework\library\Zend\Application\Bootstrap\Bootstrap.php(97): Zend_Controller_Front->dispatch()
#16 C:\ZendFramework\library\Zend\Application.php(366): Zend_Application_Bootstrap_Bootstrap->run()
#17 C:\wamp\www\STATY_ZF\public\index.php(26): Zend_Application->run()
#18 {main}


edit:
pomogło dodanie domyślnych wartości
  1. resources.router.routes.liga.defaults.l = xxx
  2. resources.router.routes.liga.defaults.s = xxx


ALE, po odpaleniu akcji z parametrami takimi jak domyślne, w URL parametry nie są zawierane ... ;x a być powinny.
Dlatego w domyślne wartości chyba wpiszę cokolwiek. closedeyes.gif