ZF-6853: Zend_Tool_Project_Provider_Controller::create() doesnt pass $module variable
Description
zend tool doesnt allow you create controller (eg. index) used in another module (eg. default) in another module.
Example: zf create project test cd test zf create module asdf zf create controller index 1 asdf
Result: This project already has a controller named index
The error is in Zend_Tool_Project_Provider_Controller::create() method, which doesnt pass $module variable to self::hasResource() method.
Error code:
if (self::hasResource($this->_loadedProfile, $name)) {
throw new Zend_Tool_Project_Provider_Exception('This project already has a controller named ' . $name);
}
Patched code:
if (self::hasResource($this->_loadedProfile, $name, $module)) {
throw new Zend_Tool_Project_Provider_Exception('This project already has a controller named ' . $name);
}
Same errors are in next code block:
Error Code:
if ($indexActionIncluded) {
$indexActionResource = Zend_Tool_Project_Provider_Action::createResource($this->_loadedProfile, 'index', $name);
$indexActionViewResource = Zend_Tool_Project_Provider_View::createResource($this->_loadedProfile, 'index', $name);
}
if ($testingEnabled) {
$testControllerResource = Zend_Tool_Project_Provider_Test::createApplicationResource($this->_loadedProfile, $name, 'index');
}
Patched Code:
if ($indexActionIncluded) {
$indexActionResource = Zend_Tool_Project_Provider_Action::createResource($this->_loadedProfile, 'index', $name, $module);
$indexActionViewResource = Zend_Tool_Project_Provider_View::createResource($this->_loadedProfile, 'index', $name, $module);
}
if ($testingEnabled) {
$testControllerResource = Zend_Tool_Project_Provider_Test::createApplicationResource($this->_loadedProfile, $name, 'index', $module);
}
Comments
Posted by Brenton Alker (brenton) on 2009-06-04T17:22:15.000+0000
This is the same issue, the failure to pass the parameter causes the conflict with existing controller in the default module.
Posted by Brenton Alker (brenton) on 2009-06-04T17:38:59.000+0000
Patch to check the correct module for the existence of the Controller, instead of assuming the default module, and pass the module name to the Action and View providers.
Posted by old of Satoru Yoshida (yoshida@zend.co.jp) on 2009-06-19T22:19:59.000+0000
Solved in SVN r16176