Hello, I've recently began my first project in Phalcon and don't understand the design decision behind LinkTo and routing parameters in general.
Taking from this post: LinkTo works not as expected I can see that at least someone else had the problem.
$router->add("/", array( 'controller' => 'index', 'action' => 'index' ))->setName('homepage'); Tag::linkTo(array(array('for' => 'homepage', 'id' => 'backLink'), 'back to homepage'))
- Why is the linkTo a double nested array instead of the shorter single array example from Tag Methods
- Why use the "for" parameter to signify the route instead of either a more direct word like "route", a completely separate parameter like ::linkTo('route-name', array('id' => 123)), or if the syntax doesn't allow it then a separate function like ::linkToRoute('route-name', array('id' => 123))
Obviously I can go and write my own class and override this behaviour, but I'd like to know why the default one so inconvenient. Coming from Zend Framework, the URL helper was very simple. By default you just specified ->url(array('id' => 123)) params, and then if you wanted to be more specific you could choose a route (default used the current route) or reset the parameters (default kept any current params).