Bartosz Rychlicki
Bartosz Rychlicki

Reputation: 1918

what's the best way to store You Zend_Log (Zend_Db) object across the application

What's the optimal way of storing objects like Zend_Log or Zend_Db across the application? You can store then in registry but then You will have to pull it from registry each time when You use them, other way is to fetch them from bootstrap, but this also involves few lines of extra code.

What I'm doing is storing them in controller variable in construct method (in controller with all other controllers are extending). But is this a good practice?

Upvotes: 0

Views: 79

Answers (1)

drew010
drew010

Reputation: 69977

Instead of extending all controllers from a base controller that injects this value, you could use an action helper to get access to the object, or use a controller plugin that can run prior to your controller being dispatched and have the plugin inject the value into the controller as well.

Upvotes: 1

Related Questions