K
K
kovalevich2014-12-17 09:01:43
Zend Framework
kovalevich, 2014-12-17 09:01:43

How to "bootstrap" in Zend Framework 1 with a modular structure?

Hello!
I am building an application on Zend Framework 1. The folder structure is as follows:


  • application
    • ...
    • modules
      • default
        • controllers
        • views
        • Bootstrap.php

      • module_1
        • controllers
        • views
        • Bootstrap.php




I want to use a separate Bootstrap class for each module. But with this structure, zf instantiates the Bootstrap classes of each of my modules. For example, I open a page that routes to the default module, but it creates instances of the Bootstrap classes from the defaul module and from the module_1 module.
Help to understand the issue.
Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Vylegzhanin, 2014-12-25
@Gridleak

This is how it should be, because bootstrap occurs before routing, at this moment modules can add their routes and it will depend on which module the request will eventually get.
Also, the request handler may need resources / something else that is provided by a specific module
[en] https://mwop.net/blog/234-Module-Bootstraps-in-Zen...
PS: nothing prevents you from making your own bootstrap (or reread the existing code), which will initialize only the modules specified in the config (for example, for different installations of the system with a different set of modules)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question