Hi all,
I've install last Phalcon version 2.0.0 and I found a difference with routing when I use the same route Name.
My Router :
$this->di->set('router', function ()
{
$router = new \Phalcon\Mvc\Router(false);
$router->setDefaultModule("main");
$router->setUriSource(\Phalcon\Mvc\Router::URI_SOURCE_SERVER_REQUEST_URI);
$router->notFound(array('controller' => 'error', 'action' => "error404" ));
$router->removeExtraSlashes(true);
require (APPLICATION_PATH . '/config/routes.php');
return $router;
});
File : routes.php (an exemple)
$router->add('/post', [ 'module' => 'main', 'controller' => 'post', 'action' => 'index'])->setName('mainPostIndex')->via(array('GET'));
$router->add('/post/{id:[0-9]+}', [ 'module' => 'main', 'controller' => 'post', 'action' => 'index'])->setName('mainPostIndex')->via(array('GET'));
Link Example in Volt with URL Component :
<a href="{{ url(['for': 'mainPostIndex' ]) }}"> Foo </a>
<a href="{{ url(['for': 'mainPostIndex', 'id' : 1 ]) }}"> Foo </a>
Phalcon 1.3.4 : both routes are matched and work perfectly.
url = /post or /post/
url = /post/1
Phalcon 2.0 : Only first route work. The second is overwrited
url = /post
url = /post
An Idea ?
Thx.