Zend Framework

Zend_Tool_Project_Provider_Controller::create() doesnt pass $module variable

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.8.1, 1.8.2
  • Fix Version/s: 1.8.4
  • Component/s: Zend_Tool
  • Labels:
    None
  • Fix Version Priority:
    Should Have

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);
            }

Issue Links

Activity

Hide
Brenton Alker added a comment -

This is the same issue, the failure to pass the parameter causes the conflict with existing controller in the default module.

Show
Brenton Alker added a comment - This is the same issue, the failure to pass the parameter causes the conflict with existing controller in the default module.
Hide
Brenton Alker added a comment -

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.

Show
Brenton Alker added a comment - 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.
Hide
Satoru Yoshida added a comment -

Solved in SVN r16176

Show
Satoru Yoshida added a comment - Solved in SVN r16176

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: