dgoosens Posted October 5, 2010 Share Posted October 5, 2010 hi all, I have been using zend tools within netbeans for quite a while now and this always worked like a charm... However, I am in the middle of a new development where I wanted to use a slightly different file structure, and it seems that I am no longer able to create any controllers or actions in the default module (other modules work fine). The file structure I decided to use is like this: /appplication /data /session /cache /modules /default /config /controllers /models /views /admin /config /controllers /models /views [...] /library /App /Zend /public In my opinion, this is a much cleaner file structure... but that is not the point. I did change my default config.ini file accordingly: bootstrap.path = APPLICATION_PATH "/modules/default/Bootstrap.php" bootstrap.class = "Bootstrap" appnamespace = "Application" resources.frontController.controllerDirectory = APPLICATION_PATH "/modules/default/controllers" resources.layout.layout = "layout" resources.layout.layoutPath = APPLICATION_PATH "/modules/default/views/layouts" resources.view.encoding = 'utf-8' resources.view.basePath = APPLICATION_PATH "/modules/default/views" resources.view[] = resources.frontController.moduleDirectory = APPLICATION_PATH "/modules/" resources.modules[] = resources.frontController.defaultController = "index" resources.frontController.defaultAction = "index" resources.frontController.defaultModule = "default" resources.frontController.prefixDefaultModule = false resources.frontController.moduleDirectory = APPLICATION_PATH "/modules" and the application works fine like this... in the browser But, when trying to run a zend tool command to create a new controller or action in the default module I get the following errors: zf.sh create controller test 1 default Fatal error: Call to a member function search() on a non-object in /home/dgoosens/DEV/LIB/ZendFramework-1.10.8/library/Zend/Tool/Project/Provider/Controller.php on line 82 Call Stack: 0.0011 814336 1. {main}() /home/dgoosens/DEV/LIB/ZendFramework-1.10.8/bin/zf.php:0 0.0012 814336 2. ZF::main() /home/dgoosens/DEV/LIB/ZendFramework-1.10.8/bin/zf.php:632 0.0053 1314392 3. ZF->run() /home/dgoosens/DEV/LIB/ZendFramework-1.10.8/bin/zf.php:74 0.0053 1314392 4. ZF->_runTool() /home/dgoosens/DEV/LIB/ZendFramework-1.10.8/bin/zf.php:117 0.0064 1453760 5. Zend_Tool_Framework_Client_Abstract->dispatch() /home/dgoosens/DEV/LIB/ZendFramework-1.10.8/bin/zf.php:608 0.1268 8921832 6. Zend_Tool_Framework_Client_Abstract->_handleDispatch() /home/dgoosens/DEV/LIB/ZendFramework-1.10.8/library/Zend/Tool/Framework/Client/Abstract.php:241 0.1269 8923048 7. Zend_Tool_Framework_Client_Abstract->_handleDispatchExecution() /home/dgoosens/DEV/LIB/ZendFramework-1.10.8/library/Zend/Tool/Framework/Client/Abstract.php:318 0.1269 8923680 8. call_user_func_array() /home/dgoosens/DEV/LIB/ZendFramework-1.10.8/library/Zend/Tool/Framework/Client/Abstract.php:324 0.1269 8924424 9. Zend_Tool_Project_Provider_Controller->create() /home/dgoosens/DEV/LIB/ZendFramework-1.10.8/library/Zend/Tool/Framework/Client/Abstract.php:0 0.1667 9451320 10. Zend_Tool_Project_Provider_Controller::hasResource() /home/dgoosens/DEV/LIB/ZendFramework-1.10.8/library/Zend/Tool/Project/Provider/Controller.php:119 If I run the command without specifying "default" as a module, zend tool creates a new file structure below /application/ The same command on the admin module, runs fine... So, my guess is zend tool does not read the config.ini settings file correctly, OR that it skips all the default settings... Any of you have encountered this kind of issues ? If so, did you figure out a way to bypass this ? (I could obviously create the files manually... but having zend tool doing the work for me is so nice) Quote Link to comment https://forums.phpfreaks.com/topic/215206-zend-tool/ Share on other sites More sharing options...
ignace Posted October 5, 2010 Share Posted October 5, 2010 You can use the Zend tool with the Zend tool created file structure any other structure means you'll have to re-write pieces of the Zend tool. Quote Link to comment https://forums.phpfreaks.com/topic/215206-zend-tool/#findComment-1119340 Share on other sites More sharing options...
dgoosens Posted October 6, 2010 Author Share Posted October 6, 2010 thanks a lot ignace, you would not know where this particular setting is located in the zend tool files would you ? I suppose that it should be fairly easy to overrule the settings for the default module so that it works just like it does for all the other modules... Quote Link to comment https://forums.phpfreaks.com/topic/215206-zend-tool/#findComment-1119527 Share on other sites More sharing options...
ignace Posted October 6, 2010 Share Posted October 6, 2010 Open the zf.bat with a text editor. Quote Link to comment https://forums.phpfreaks.com/topic/215206-zend-tool/#findComment-1119551 Share on other sites More sharing options...
dgoosens Posted October 6, 2010 Author Share Posted October 6, 2010 Open the zf.bat with a text editor. lol that would be zf.sh in my case (no bloody Windows here) but, that will not help, obviously... as this only is a wrapper for zf.php that uses all the classes in Zend_Tool That's where I need to figure out where the module default settings are defined... Quote Link to comment https://forums.phpfreaks.com/topic/215206-zend-tool/#findComment-1119562 Share on other sites More sharing options...
dgoosens Posted October 6, 2010 Author Share Posted October 6, 2010 ok... so I figured it out... this has nothing to do with the Zend_Tool scripts but with the .zfproject.xml that was generated for the project. This XML file contains the project layout... which, obviously uses the default Zend Application layout. All I had to do there was create a new <moduleDirectory> node under <modulesDirectory> with a moduleName="default" attribute Then, cut/paste all the controller, model and view nodes in there... and that did the trick Just in case, here is a simplified version of the XML file: <?xml version="1.0"?> <projectProfile type="default" version="1.10"> <projectDirectory> <projectProfileFile filesystemName=".zfproject.xml"/> <applicationDirectory classNamePrefix="Application_"> <modulesDirectory enabled="false"> <moduleDirectory moduleName="default"> <apisDirectory enabled="false"/> <configsDirectory> <applicationConfigFile type="ini"/> </configsDirectory> <controllersDirectory> <controllerFile controllerName="Index"> <actionMethod actionName="index"/> </controllerFile> <controllerFile controllerName="Error"/> <controllerFile controllerName="Test"> <actionMethod actionName="index"/> </controllerFile> [...] </controllersDirectory> <formsDirectory enabled="false"/> <layoutsDirectory enabled="false"/> <modelsDirectory> [...] </modelsDirectory> <viewsDirectory> <viewScriptsDirectory> <viewControllerScriptsDirectory forControllerName="Index"> <viewScriptFile forActionName="index"/> </viewControllerScriptsDirectory> <viewControllerScriptsDirectory forControllerName="Error"> <viewScriptFile forActionName="error"/> </viewControllerScriptsDirectory> <viewControllerScriptsDirectory forControllerName="Test"> <viewScriptFile forActionName="index"/> </viewControllerScriptsDirectory> [...] </viewScriptsDirectory> <viewHelpersDirectory/> <viewFiltersDirectory enabled="false"/> </viewsDirectory> <bootstrapFile filesystemName="Bootstrap.php"/> </moduleDirectory> <moduleDirectory moduleName="admin"> <apisDirectory enabled="false"/> <configsDirectory enabled="false"/> <controllersDirectory> <controllerFile controllerName="Index"> <actionMethod actionName="index"/> [...] </controllerFile> </controllersDirectory> <formsDirectory enabled="false"/> <layoutsDirectory enabled="false"/> <modelsDirectory> [...] </modelsDirectory> <viewsDirectory> <viewScriptsDirectory> <viewControllerScriptsDirectory forControllerName="Index"> <viewScriptFile forActionName="index"/> </viewControllerScriptsDirectory> [...] </viewControllerScriptsDirectory> </viewScriptsDirectory> <viewHelpersDirectory/> <viewFiltersDirectory/> </viewsDirectory> </moduleDirectory> [...] </applicationDirectory> <dataDirectory enabled="false"> [...] </dataDirectory> <docsDirectory> [...] </docsDirectory> <libraryDirectory> [...] </libraryDirectory> <publicDirectory> [...] </publicDirectory> <projectProvidersDirectory enabled="false"/> <temporaryDirectory enabled="false"/> <testsDirectory> [...] </testsDirectory> </projectDirectory> </projectProfile> Quote Link to comment https://forums.phpfreaks.com/topic/215206-zend-tool/#findComment-1119587 Share on other sites More sharing options...
dgoosens Posted October 7, 2010 Author Share Posted October 7, 2010 just noticed that with the XML configuration, it was not possible anymore to create new modules... it should be like this: <?xml version="1.0"?> <projectProfile type="default" version="1.10"> <projectDirectory> <projectProfileFile filesystemName=".zfproject.xml"/> <applicationDirectory classNamePrefix="Application_"> <apisDirectory enabled="false"/> <configsDirectory> <applicationConfigFile type="ini"/> </configsDirectory> <controllersDirectory> </controllersDirectory> <formsDirectory enabled="false"/> <layoutsDirectory enabled="false"/> <modelsDirectory> </modelsDirectory> <modulesDirectory enabled="false"> <moduleDirectory moduleName="default"> <apisDirectory enabled="false"/> <configsDirectory> <applicationConfigFile type="ini"/> </configsDirectory> <controllersDirectory> <controllerFile controllerName="Index"> <actionMethod actionName="index"/> </controllerFile> <controllerFile controllerName="Error"/> <controllerFile controllerName="Test"> <actionMethod actionName="index"/> </controllerFile> [...] </controllersDirectory> <formsDirectory enabled="false"/> <layoutsDirectory enabled="false"/> <modelsDirectory> [...] </modelsDirectory> <viewsDirectory> <viewScriptsDirectory> <viewControllerScriptsDirectory forControllerName="Index"> <viewScriptFile forActionName="index"/> </viewControllerScriptsDirectory> <viewControllerScriptsDirectory forControllerName="Error"> <viewScriptFile forActionName="error"/> </viewControllerScriptsDirectory> <viewControllerScriptsDirectory forControllerName="Test"> <viewScriptFile forActionName="index"/> </viewControllerScriptsDirectory> [...] </viewScriptsDirectory> <viewHelpersDirectory/> <viewFiltersDirectory enabled="false"/> </viewsDirectory> <bootstrapFile filesystemName="Bootstrap.php"/> </moduleDirectory> <moduleDirectory moduleName="admin"> <apisDirectory enabled="false"/> <configsDirectory enabled="false"/> <controllersDirectory> <controllerFile controllerName="Index"> <actionMethod actionName="index"/> [...] </controllerFile> </controllersDirectory> <formsDirectory enabled="false"/> <layoutsDirectory enabled="false"/> <modelsDirectory> [...] </modelsDirectory> <viewsDirectory> <viewScriptsDirectory> <viewControllerScriptsDirectory forControllerName="Index"> <viewScriptFile forActionName="index"/> </viewControllerScriptsDirectory> [...] </viewControllerScriptsDirectory> </viewScriptsDirectory> <viewHelpersDirectory/> <viewFiltersDirectory/> </viewsDirectory> </moduleDirectory> [...] </modulesDirectory> <viewsDirectory> </viewsDirectory> </applicationDirectory> <dataDirectory enabled="false"> [...] </dataDirectory> <docsDirectory> [...] </docsDirectory> <libraryDirectory> [...] </libraryDirectory> <publicDirectory> [...] </publicDirectory> <projectProvidersDirectory enabled="false"/> <temporaryDirectory enabled="false"/> <testsDirectory> [...] </testsDirectory> </projectDirectory> </projectProfile> One has to leave the default nodes in place... Quote Link to comment https://forums.phpfreaks.com/topic/215206-zend-tool/#findComment-1119787 Share on other sites More sharing options...
jordan_phpfreak Posted April 23, 2012 Share Posted April 23, 2012 Hello! It solved to me: http://framework.zend.com/issues/browse/ZF-8389?focusedCommentId=50351#comment-50351 Quote Link to comment https://forums.phpfreaks.com/topic/215206-zend-tool/#findComment-1339829 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.