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

Commit

Permalink
Merge branch 'hotfix/sm-plugin-managers-not-peering' of https://githu…
Browse files Browse the repository at this point in the history
…b.com/EvanDotPro/zf2 into hotfix/plugins-peering-removal
  • Loading branch information
weierophinney committed Jul 3, 2012
3 parents 4bd5c7f + a75fb6a + e013f08 commit ba628cd
Showing 1 changed file with 26 additions and 4 deletions.
30 changes: 26 additions & 4 deletions src/AbstractPluginManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* @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 AbstractPluginManager extends ServiceManager
abstract class AbstractPluginManager extends ServiceManager implements ServiceLocatorAwareInterface
{
/**
* Allow overriding by default
Expand All @@ -52,11 +52,11 @@ abstract class AbstractPluginManager extends ServiceManager
protected $creationOptions = null;

/**
* Enable this by default to allow overriding the default plugins
* The main service locator
*
* @var bool
* @var ServiceLocatorInterface
*/
protected $retrieveFromPeeringManagerFirst = true;
protected $serviceLocator;

/**
* Constructor
Expand Down Expand Up @@ -137,6 +137,28 @@ public function setService($name, $service, $shared = true)
return $this;
}

/**
* Set the main service locator so factories can have access to it to pull deps
*
* @param ServiceLocatorInterface $serviceLocator
* @return AbstractPluginManager
*/
public function setServiceLocator(ServiceLocatorInterface $serviceLocator)
{
$this->serviceLocator = $serviceLocator;
return $this;
}

/**
* Get the main plugin manager. Useful for fetching dependencies from within factories.
*
* @return mixed
*/
public function getServiceLocator()
{
return $this->serviceLocator;
}

/**
* Attempt to create an instance via an invokable class
*
Expand Down

0 comments on commit ba628cd

Please sign in to comment.