Issues

ZF-6853: Zend_Tool_Project_Provider_Controller::create() doesnt pass $module variable

Issue Type: Bug Created: 2009-05-28T19:32:10.000+0000 Last Updated: 2011-08-04T09:36:23.000+0000 Status: Resolved Fix version(s): - 1.8.4 (23/Jun/09)

Reporter: Josef Jedlicka (m0rf) Assignee: Satoru Yoshida (satoruyoshida) Tags: - Zend_Tool

Related issues: - ZF-6755

Attachments: - Zend_Tool_Project_Provider_Controller.php.diff

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:

<pre class="highlight">
        if (self::hasResource($this->_loadedProfile, $name)) {
            throw new Zend_Tool_Project_Provider_Exception('This project already has a controller named ' . $name);
        }

Patched code:

<pre class="highlight">
        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:

<pre class="highlight">
            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:

<pre class="highlight">
            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

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts