Skip to content
This repository has been archived by the owner on Jul 1, 2020. It is now read-only.

Allow you to get ServiceManager from everywhere in your application

License

Notifications You must be signed in to change notification settings

fezfez/ServiceLocatorFactory

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Allow you to get ServiceManager from everywhere in your application

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages