Understanding the Zend Framework loading process and loading resources from application.ini

I am well acquainted with the details of the Zend Framework and how most work. One area that I still don’t fully understand is how the Zend Framework loads resources from application.ini.

I understand that I can create my own protected _init functions, and they will be called automatically at boot time.

Zend Framework documentation is not available in certain areas.

For example: How and when are resources.db configuration parameters loaded? There is nothing in my bootstrap that says db. Is it loaded on demand or in fact during the boot process?

Any link links explaining this will be very helpful.

+6
source share
1 answer

Your bootstrap class will ultimately inherit from Zend_Application_Bootstrap_BootstrapAbstract . The bootstrap() method in this class first searches for class methods with the _init prefix and runs them. He then searches for resource plugins that are filled with part of the resources in the options array. The parameter array comes from the configuration passed to Zend Application, which usually comes from application.ini.

Resource plugins are mapped to a class in the file system. So, resources.db by default create an instance of Zend_Application_Resource_Db and run it (which in turn sets the corresponding db stuff). Here is a complete list of built-in resources: http://framework.zend.com/manual/en/zend.application.available-resources.html

All your application resources are launched during the boot process, unless you told the boot block to initialize only certain ones.

There is a fairly detailed overview of how all this is combined in the documents: http://framework.zend.com/manual/en/zend.application.theory-of-operation.html , but this is something you really do not need to find out details if your requirements are a little common.

+10
source

Source: https://habr.com/ru/post/908919/


All Articles