Named params in routing

I have one action mapped to two routes. Action look like this:

public function indexAction($salon=null,$page=null)

And routes like this, its route group witch is mounted later:

$this->addGet('/index/{salon:[0-9]+$}', array('action'=>'index','controller'=>'department'));
$this->addGet('/page/{page:[0-9]+$}', array('action'=>'index','controller'=>'department'));

But when i acess /page/1 the page is stored in $salon, is that how it should work ?


Yes, this is how it should work. You should rewrite it:

$this->addGet('/page/{salon:[0-9]+$}/{page:[0-9]+$}', array('action'=>'index','controller'=>'department'));

Or just forget about method params and use

public function indexAction()
    $salon = $this->dispatcher->getParam('salon');

You can visualize all params: