I am experiencing problems with routing on cakephp 4.x
I have a connector in routes.php like this :
$routes->connect(
'/achat-vente-location/licences-{type}/departement/{slug}/{id}',
[
'controller' => 'Licences',
'action' => 'departement',
'prefix' => null
]
)
->setPatterns(
[
'id' => '[0-9]+',
'type' => 3
]
)
->setPass(
[
'id',
'type',
'slug'
]
);
In my view, I am trying to generate the correct url like this :
Router::url([
'controller' => 'Licences',
'action' => 'departement',
'type' => 3,
'slug' => 'Slug',
'id' => 33321
]);
But it does not generate the good URL and I do not know why. I get this URL :
https://localhost/licences/departement
What is expected :
https://localhost/achat-vente-location/licences-3/departement/Slug/33321
Thanks to everyone for your help !