I'm currently migrating a v2 site into v3 and came across an issue with routes that I'm not being able to fix on my own so maybe someone around here had the same problem. So I have this route:
http://example.com/installer-review/postcodes/...
The route rule is:
$routes->connect('/installer-review/postcodes/*',
['controller' => 'InstallerReviews', 'action' => 'postcodes'],
);
When I go to the url it redirects correctly to the action "postcodes" of InstallerReviews but anytime I try to do: Router::url(['controller' => 'installer-review', 'action' => 'postcodes']); To generate a link to an InstallerReviews action it generates: http://example.com/installer_review/postcodes
This didn't happen to V2 and now is happening for V3.
I've used different classRoutes on the routes file but nothing worked, I've been using InflectedRoute to increase compatibility with the previous version but while debugging the route generation using InflectedRoute at some point it transforms all "-" into "_" which breaks my original route rule.
So because of this issue I tried creating a custom route rule, and followed the information at [http://book.cakephp.org/3.0/en/development/routing.html#custom-route-classes][1] , but this turned out to be another headache, if I do:
$routes->connect('/installer-review/postcodes/*',
['controller' => 'InstallerReviews', 'action' => 'postcodes'],
['routeClass' => 'MyRoute']
);
It starts throwing errors about the class MyRoute already being declared.
The solution I have right now was implementing my own Url::build function that overwrites the original helper function but this feels too "hackish" for me so was hoping for a cleaner solution.
Sorry about the big wall but didn't want to leave anything out, thanks for any help