I am pretty familiar with Zend Framework details and how most things work. One area that I still don't fully understand is the way Zend Framework loads resources from application.ini.
I understand I can create my own protected _init functions and these will be called automatically during bootstrap.
The Zend Framework documentation is lacking in certain areas.
For example: How and when does the resources.db config options get loaded? I have nothing in my bootstrap that talks about db. Does this get loaded on demand or actually during the bootstrap process?
Any links of references explaining this would be very helpful.
Your bootstrap class ultimately inherits from Zend_Application_Bootstrap_BootstrapAbstract
. The bootstrap()
method in this class first searches for class methods prefixed with _init
, and runs these. It then looks for resource plugins, which are populated by the 'resources' part of the options array. The options array comes from the configuration passed to Zend Application, which usually comes from application.ini.
Resource plugins map to a class on the file system. So resources.db
by default will create an instance of Zend_Application_Resource_Db
and run it (which in turns sets up the relevant db stuff). There is a full list of the built in resources here: http://framework.zend.com/manual/en/zend.application.available-resources.html
All your application resources are run during the bootstrap process, unless you've told the bootstrap to init only specific ones.
There is a reasonably detailed overview of how it all fits together in the docs: http://framework.zend.com/manual/en/zend.application.theory-of-operation.html, but it's the kind of thing that you don't really need to know the details of unless your requirements are a little custom.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With