|
Nested modules are incredibly useful (both during development, deployment and for sales purposes) when developing a suite of tightly related modules. Namespaces flow naturally (across 50 odd classes), dependencies become obvious, and the suite can be packaged as a single folder for deployment.
Presently Magento inadvertently supports these for most code structures, but not controllers. The offending line of code resides in
Mage_Core_Controller_Varien_Router_Standard
, within the function
public function getControllerFileName($realModule, $controller) { $parts = explode('_', $realModule); [b] $realModule = implode('_', array_splice($parts, 0, 2));[/b] $file = Mage::getModuleDir('controllers', $realModule); if (count($parts)) { $file .= DS . implode(DS, $parts); } $file .= DS.uc_words($controller, DS).'Controller.php'; return $file; }
where the assumption is made that realModule always has a 2 part mantissa:
$realModule = implode('_', array_splice($parts, 0, 2));
This causes controller support to fail when variables are such:
$realModule = 'Company_Suite_Group_Functionality'; $controller = 'order';
The result at the end of the function is:
$realModule = 'Company_Suite'; $file = '...../app/code/local/Company/Suite/controllers/Group/Functionality/OrderController'
instead of
$realModule = 'Company_Suite_Group_Functionality'; $file = '...../app/code/local/Company/Suite/Group/Functionality/controllers/OrderController'
I realise a custom router can be used to change this behaviour, but would the Magento team consider modifying this assumption so that support for deeper modules is natively available?
|