Allow you to get ServiceManager from everywhere in your application
PHP
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src/ServiceLocatorFactory
LICENSE
Module.php
README.md
composer.json

README.md

ServiceLocatorFactory

Project Status

Allow you to get ServiceManager from everywhere in your application by calling this static factory.

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