2017 © Pedro PelĂĄez
 

library service-locator-factory

Get the service locator in zf2

image

fezfez/service-locator-factory

Get the service locator in zf2

  • Tuesday, September 30, 2014
  • by fezfez
  • Repository
  • 0 Watchers
  • 0 Stars
  • 812 Installations
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 3 % Grown

The README.md

ServiceLocatorFactory

Project Status, (*1)

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);
    }
}

The Versions

30/09 2014

dev-master

9999999-dev https://github.com/fezfez/ServiceLocatorFactory

Get the service locator in zf2

  Sources   Download

MIT

The Requires

 

by Demonchaux Stéphane

zf2 factory servicelocator