Problem with using multiple colon separated values in URL

Hello Phalcon community,

I have problem with routing and generating URLs who have more than one value separated by colon. I found one discusion here about that ( but that was about one value separated by colon.

I'm trying to reach something like this:

So I created model, views and controller for that, and in routes.php I added something like this:

$router->add('/movies', "Movies::allMovies")->setName('movies-index');
$router->add('/movies/page:([0-9]+)', array(
    'controller' => 'movies',
    'action'     => 'allMovies',
    'page'       => 1
$router->add('/movies/page:([0-9]+)/sort:([a-z]+)', array(
    'controller' => 'movies',
    'action'     => 'allMovies',
    'page'       => 1,
    'sort'       => 2

In controller I'm receiving this data via dispatcher and it works fine. Problem is starting when I'm trying to generate URL via {{ url(["for"]) }} or {{ link_to(["for"]) }}. For router named "movies-index" everything works fine, and url function generates me a proper URL address, same thing happens for movies-index-page ({{ url(["for": "movies-index-page", "page": ":10"]) }}). I have a problem when I'm trying generate URL with second parameter separated by semicolon. When i write something like this:

{{ url(["for": "movies-index-page-sort", "page": ":12", "sort": ":created"]) }}

URL function generates me something like this:


I have tried everything. I even tried solving that problem with documentation ( but without any positive result :(

II'll be grateful for any hint to solve this problem :)

P.S. Sorry for my rusty English. It isn't my native language but I'm trying as best I can :)



taken from the doc you have noticed:

"If the desired schema is:, the following code is required:"


use Phalcon\Dispatcher,
    Phalcon\Mvc\Dispatcher as MvcDispatcher,
    Phalcon\Events\Manager as EventsManager;

$di->set('dispatcher', function() {

    //Create an EventsManager
    $eventsManager = new EventsManager();

    //Attach a listener
    $eventsManager->attach("dispatch:beforeDispatchLoop", function($event, $dispatcher) {

        $keyParams = array();
        $params = $dispatcher->getParams();

        //Explode each parameter as key,value pairs
        foreach ($params as $number => $value) {
            $parts = explode(':', $value);
            $keyParams[$parts[0]] = $parts[1];

        //Override parameters

    $dispatcher = new MvcDispatcher();

    return $dispatcher;