Routes conflict with default value
$this->add (
'/controller/:action/:int/:params',
array (
'action' => 1,
'id' => 2,
'page' => 1 //value default 1 conflicts with action 1
)
)
->setName ( 'teste' );
Details
- Phalcon version: 3.0
- PHP Version: 7.0.8
- Operating System: ubuntu 16.04
What you mean conflict ? What exactly is the problem ? Where is script to reproduce ? Expected and actual behavior ? Default parameter value should be setted in controller method, not in route i think.
$this->add (
'/controller/:action/:int/:params',
array (
'action' => 1,
'id' => 2,
'page' => 1,
)
)
->setName ( 'Router' );
//view
{{ url(['for': 'Router', 'action':'index', 'id':51 ]) }}
result is: localhost/controller//51
$this->add (
'/controller/:action/:int/:params',
array (
'action' => 1,
'id' => 2,
)
)
->setName ( 'Router' );
//view
{{ url(['for': 'Router', 'action':'index', 'id':51 ]) }}
result is: localhost/controller/index/51
there is a conflict when setted default values on the router and passed to url
You should not pass default values on the router, then it should be removed functionality, not to experience unexpected results
but where is this functionality ? Just value of first parameter('action') is passed to page parameter, not action parameter.
Thank you for contributing to this issue. As it has been 90 days since the last activity, we are automatically closing the issue. This is often because the request was already solved in some way and it just wasn't updated or it's no longer applicable. If that's not the case, please feel free to either reopen this issue or open a new one. We will be more than happy to look at it again! You can read more here: https://blog.phalconphp.com/post/github-closing-old-issues