简体   繁体   中英

Controller folders and the new Autoloader in Zend Framework

After introduction of Autoloader, I started to port existing ZF app. The immediate error was that IndexController was extended by BaseController, which is now cannot be found , although it resides in application/controllers folder, with other controllers.

Does the autoloader paradigm require that BaseController is renamed to My_BaseController and put into library folder? On the other hand, it's so nice to keep all controllers in one folder with a BaseController.

The module autoloader does not load from the Controller's folder by default. You can either add the folder to the included Module autoloader or create your own resource autoloader.

See http://framework.zend.com/manual/en/zend.loader.autoloader-resource.html#zend.loader.autoloader-resource.module for info on the Resource / Module autoloader.

You could do things the old fashioned way though and just require_once('BaseController.php');

I haven't actually seen anything use application/controllers before

Generally, stuff would go into application/modules/<module>/controllers/ where "generic" controllers would go into the default module

You might get a better answer if the above is incorrect if you mention what versions your transitioning between, and how you're trying to call the controller?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM