Created
November 16, 2012 22:18
-
-
Save rlandas/4091394 to your computer and use it in GitHub Desktop.
ZF2: Extract (get) the module namespace from the requestedName in AbstractFactory class
This file contains hidden or 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
namespace MyModule\Factory; | |
use Zend\ServiceManager\AbstractFactoryInterface; | |
class SomeClassFactory implements AbstractFactoryInterface { | |
// ... some other code | |
/** | |
* Determine if we can create a service with name | |
* | |
* @param ServiceLocatorInterface $serviceLocator | |
* @param $name | |
* @param $requestedName | |
* @return bool | |
*/ | |
public function canCreateServiceWithName (ServiceLocatorInterface $serviceLocator, $name, $requestedName) | |
{ | |
$namespace = substr($requestedName, 0, strpos($requestedName, '\\')); | |
return true; | |
} | |
// ... some other code | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment