dev-master
9999999-dev https://github.com/fezfez/ServiceLocatorFactoryGet the service locator in zf2
MIT
The Requires
- php >=5.3.0
- zendframework/zendframework 2.*
by Demonchaux Stéphane
zf2 factory servicelocator
Wallogit.com
2017 © Pedro PelĂĄez
Get the service locator in zf2
Allow you to get ServiceManager from everywhere in your application by calling this static factory., (*2)
<?php
namespace Corp\News;
use Corp\News\NewsDAO;
use Zend\ServiceManager\ServiceManager;
use Corp\ServiceLocator\ServiceLocator;
class NewsDAOFactory
{
private function __construct()
{
}
/**
* @return \Corp\News\NewsDAO
*/
public static function getInstance()
{
$sm = ServiceLocatorFactory::getInstance();
$em = $sm->get('doctrine.entitymanager.orm_default');
return new NewsDAO($em);
}
}
Get the service locator in zf2
MIT
zf2 factory servicelocator