Last active
October 6, 2016 19:14
-
-
Save DanyelMorales/03adfd367f23576f7b53081e5b5dc83b to your computer and use it in GitHub Desktop.
Get RouteMatch object from ServiceManager inside a factory in ZendFramework 2
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
<?php | |
// ... | |
public function createService(ServiceLocatorInterface $serviceLocator) | |
{ | |
$sm = $serviceLocator->getServiceLocator(); | |
$routeMatch = $sm->get('application')->getMvcEvent()->getRouteMatch(); | |
$param = $routeMatch->getParam('id', 0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment