All Projects → fezfez → ServiceLocatorFactory

fezfez / ServiceLocatorFactory

Licence: MIT license
Allow you to get ServiceManager from everywhere in your application

Programming Languages

PHP
23972 projects - #3 most used programming language

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);
    }
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].