Hello, i had a problem and needed to load by default a controller with a different name than the module.
All my modules had plural names (modules, clients, projects, examples), i was using gas orm and i had the same table names (plural) as module names and gas orm needed to have the module class the same as the database tables, so if i wanted to have a controller called clients in my clients module it would get in conflict with the clients model. So i wanted to be able to load a different controller by default, i thought that a simple takedown of this problem would be to make it so the modules keep their plural names and the controllers to be put at singular. I did not change the default functionality if you would have a module projects, with a controller projects it would load it by default even if you had another controller project, but, if you had a module projects and a controller project, with the code below, it would first search for the controller with the same name as the module and if not found, it would search for the singular name controller and load it ( so that you would not have to type projects/project to access it, or use routes for every module you have)
the code is:
on third_party/MX/Router.php or libraries/MX/Router.php under line 122 add
/* module singular controller exists? edit dantdr */
if(is_file($source.substr($module, 0, -1).$ext)) {
$segments[0] = substr($module, 0, -1);
return $segments;
}
this makes it work, but is there a better way to do this? and if it is, could it be added to the next version of Modular Extension?