Created
April 27, 2012 13:06
-
-
Save prolic/2509032 to your computer and use it in GitHub Desktop.
Generate a service locator when in development mode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$config; // array with di configuration | |
if (APPLICATION_ENV == 'development' || !class_exists('Application\Context') { | |
$di = new Zend\Di\Di($config); | |
$generator = new Generator($di); | |
$generator->setNamespace('Application') | |
->setContainerClass('Context'); | |
$file = $generator->getCodeGenerator(); | |
$file->setFilename(__DIR__ . '/../Application/Context.php'); | |
$file->write(); | |
} | |
$context = new Appliation\Context; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment