Question

Suppose that I have a library located in:

lib/Acme/

This library has to be statically initialized (once!) through the following call:

AcmeBootstrap::init($data);

$data in the above call is obtained through the system configuration table and augmented through XML configurations found in both the community and local pools.

The Acme library is (currently projected to be) only used in a single helper class. Immediately, my instincts tell me to perform lazy-initialization in the helper file, but like everything else in Magento -- the "norm" goes against all reason. I really do not want to add anything to the Magento bootstrap -- everything should be handled inside the module itself.

Am I going about this correctly, or am I gonna get roasted for even asking?

Was it helpful?

Solution

Immediately, my instincts tell me to perform lazy-initialization in the helper file, but

That's perfectly reasonable, initialize before it's used the first time.

Magento does not have a single place to add bootstrap code, so it's not violating any conventions.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top