Overriding routes

I’m trying to implement a Solr-based advanced search page. I can use the default advanced search page by making a few custom .phtml files, but the default controller does not create the query I want.

I’d like to change the controller defined in the routing to my own controller. Is there a way to control the order in which routes are added? My module.php adds the route in its onBootstrap method, but this is run before Search’s onBootstrap method runs.

Partial update - I was able to redirect to another controller and get the results I want by adding to local.config.php, but this feels wrong.


I once found a (partial) solution for overriding routes and actions within modules, but it is far from perfect:

The typical way to modify configuration in a module is just to specify it in your module’s config.

If there’s an ordering issue with overriding or being overridden by another module’s config, there’s also an event provided by Laminas that lets you modify the configuration after its all been merged together. See their documentation on the subject.

This topic was automatically closed 250 days after the last reply. New replies are no longer allowed.