Try Router::promote()
:
Router::promote()
Promote a route (by default, the last one added) to the beginning of the list
If I understood your question correctly, you wanted to overwrite just one route. In your app/Config/routes.php
, add the overridden route and a promote after CakePlugin::routes();
//.... your routes....
//Here the plugin routes being loaded
CakePlugin::routes();
//Overwrite route:
Router::connect('/accessDenied', array('plugin' => 'usermgmt', 'controller' => 'users', 'action' => 'accessDenied'));
Router::promote(); //and promote it
That should do the trick. Promote does nothing but move the last route to top. In CakePHP, routing works as first-come-first-served basis (if you check the source closely it's an array), so promoting will move your last defined route to top and hence overwrite the route defined in the plugin.
Edit
If you do not like promoting, you can also define the route before CakePlugin::routes()
. That should do the trick as well.