6j. Registry

gjerokrsteski edited this page Mar 17, 2014 · 2 revisions

A well-known object that other objects can use to find common objects and services. Acts also as a dependency injection container. Note that storing resources in a registry is not permitted!

Common access

 $registry = new Pimf\Registry();
 $registry->your_key = "123";

Static access

 Pimf\Registry::set('your_key', "123")
 Pimf\Registry::get('your_key')

Following objects are directly accessible and come out of the box:

conf represents the configuration list.

 $conf = Pimf\Registry::get('conf')

env represents Pimf\Environment object which delivers methods for server and execution environment information.

 $env = Pimf\Registry::get('env')

logger represents Pimf\Logger object which delivers methods for common logging options into a file.

 $logger = Pimf\Registry::get('logger')

em represents Pimf\EntityManager object which delivers methods for data persistence and object relational mapping.

 $em = Pimf\Registry::get('em')
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.