We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

[Phalcon 2] Cutting links MVC/URL

Hello everyone. I was faced with the problem of removing the last character when creating a link. I have a code:

$router->removeExtraSlashes(true);
$blog = new \Phalcon\Mvc\Router\Group(array( 'controller' => 'post' ));
$blog->setPrefix('/post');
$blog->add('/:action', array( 'action' => 'show', 'slug' => 1 ))
     ->setName('post-link');
$blog->add('/:action/edit', array( 'action' => 'edit', 'slug' => 1 ))
     ->setName('post-edit');
$blog->add('/:action/delete', array( 'action' => 'delete', 'slug' => 1 ))
     ->setName('post-delete');
$router->mount($blog);

And there is here such code:

$this->url->get([ 'for' => 'post-link', 'slug' => $post->slug ])

It returns a normal link:

/post/some-post-name

And there is here such code:

$this->url->get([ 'for' => 'post-delete', 'slug' => $post->slug ])

It returns the trimmed link:

/post/some-post-name/delet

What could be the problem? Using branch 2.0.1. Thx.