forked from zendframework/zendframework
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'SocalNick/hotfix/di-plugin-managers'
- Loading branch information
Showing
3 changed files
with
72 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<?php | ||
/** | ||
* Zend Framework | ||
* | ||
* LICENSE | ||
* | ||
* This source file is subject to the new BSD license that is bundled | ||
* with this package in the file LICENSE.txt. | ||
* It is also available through the world-wide-web at this URL: | ||
* http://framework.zend.com/license/new-bsd | ||
* If you did not receive a copy of the license and are unable to | ||
* obtain it through the world-wide-web, please send an email | ||
* to [email protected] so we can send you a copy immediately. | ||
* | ||
* @category Zend | ||
* @package Zend_Mvc | ||
* @subpackage Service | ||
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
*/ | ||
|
||
namespace Zend\Mvc\Service; | ||
|
||
use Zend\ServiceManager\Di\DiAbstractServiceFactory; | ||
use Zend\ServiceManager\Di\DiServiceInitializer; | ||
use Zend\ServiceManager\FactoryInterface; | ||
use Zend\ServiceManager\ServiceLocatorInterface; | ||
|
||
/** | ||
* @category Zend | ||
* @package Zend_Mvc | ||
* @subpackage Service | ||
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
*/ | ||
abstract class AbstractPluginManagerFactory implements FactoryInterface | ||
{ | ||
const PLUGIN_MANAGER_CLASS = 'AbstractPluginManager'; | ||
|
||
/** | ||
* Create and return a plugin manager. | ||
* Classes that extend this should provide a valid class for | ||
* the PLUGIN_MANGER_CLASS constant. | ||
* | ||
* @param ServiceLocatorInterface $serviceLocator | ||
* @return AbstractPluginManager | ||
*/ | ||
public function createService(ServiceLocatorInterface $serviceLocator) | ||
{ | ||
$pluginManagerClass = static::PLUGIN_MANAGER_CLASS; | ||
$plugins = new $pluginManagerClass; | ||
$configuration = $serviceLocator->get('Configuration'); | ||
if (isset($configuration['di']) && $serviceLocator->has('Di')) { | ||
$di = $serviceLocator->get('Di'); | ||
$plugins->addAbstractFactory( | ||
new DiAbstractServiceFactory($di, DiAbstractServiceFactory::USE_SL_BEFORE_DI) | ||
); | ||
$plugins->addInitializer( | ||
new DiServiceInitializer($di, $serviceLocator) | ||
); | ||
} | ||
return $plugins; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters