2
votes

I created an class extension of Zend_Controller_Action and added some user defined methods, which will be accessed from any controller so forth.

Every thing is working fine, until I use Zend Tool to create a new Action, as this time The Zend tool will not find out my extended class.

Error Message:

Fatal error: Class 'CMS_Zend_Controller_Action' not found in....

That is the class which extends Zend_Controller_Action and the one extended by other controllers like indexController.

How to make the class discoverable. Do I have to include each and every folders, like my classes are? Does zend does that? I dont think so. How does it do it?

2
Where in your application is the CMS_Zend_Controller_Action located? I'd also recommend against including 'Zend' in your class names - the convention would be to use your own namespace instead of the word 'Zend', not in addition to it. So you'd have CMS_Controller_Action instead.Tim Fountain
@Tim Fountain, I am extending Zend_Controller_Action, So I preferred to indicate that as well. And also because, I also have my own CMS_Controller_Action tooStarx
Just a confirmation: I was able to replicate this using Netbeans+Zend Framework Support on Windows. While debugging I realized that Zend_Tool does not use the application bootstrap mechanisms (at least not when I tested this).madflow
@madflow, exactly. That might be the problem. How to fix it?Starx

2 Answers

0
votes

Simple. :-p If it can find your core controllers, then you just need to include the path to your extended controllers.

http://php.net/manual/en/function.set-include-path.php

set_include_path(path_to_your_extended_classes) in your index.php, aka routes file.

0
votes

I think what you are trying here is not what Zend_Tool is about.

As much as I understand your question and setup you have created a class in your library. Of course, you can extend Zend_Controller_Action with lots of your own classes in your own library/libraries (I do that, too). Adding an action to such a class is maybe unusual but a problem for Zend_Tool for one specific reason.

Zend_Tool I believe is only about the well known structures like /application and same for what is inside /modules. If you create a Controller Class Zend_Tool will do some work for you like adding required folder structure to your /application or /modules folder. Same with action method which require view files. Having a Controller Class in your library does not (should not) need all that and hence is not build into Zend_Tool. I think whatever class you create in your library is not supported in Zend_Tool.