The manual on Zend_Application_Module_Autoloader states the following:
When using module bootstraps with Zend_Application, an instance of Zend_Application_Module_Autoloader will be created by default for each discrete module, allowing you to autoload module resources.
This requires me to create an empty bootstrap class for each of my modules or else resource autoloading per module won’t work with the build-in autoloader.
Now I have two questions
- What is a discrete module?
- Is there a way to have this resource autoloader registered by default for each module without the need to create a bootstrap file for each module? I want it available in each module and creating so many empty bootstrap classes is something i’d rather prevent.
I understand your reluctance to add an empty bootstrap class to each module. However, consider the case for re-use: if you are able to bundle your module separately, you can then drop it into another application later, and autoloading will work immediately, with no extra work. This was one of the use cases for having module bootstraps, and why it currently works the way it does.
(“Discrete” in this case means “self-contained”, and not part of the “application” module.)
If you don’t like how this operates, you’re free to omit the module bootstrap — you’ll simply need to add in a resource autoloader for the module yourself somehow. This can be done via a bootstrap resource method fairly easily. However, as someone earlier posted: why re-invent the wheel when something that’s tested and documented gets the job done? 🙂