Skip to content

Instantly share code, notes, and snippets.

@Saeven
Created May 23, 2014 13:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Saeven/bb5a95c27afbc186cdb8 to your computer and use it in GitHub Desktop.
Save Saeven/bb5a95c27afbc186cdb8 to your computer and use it in GitHub Desktop.
Possible to switch a route?
$sem->attach('Zend\Mvc\Application', MvcEvent::EVENT_ROUTE, function( MvcEvent $ev) use($sm,$em) {
$rm = $ev->getRouteMatch()->getMatchedRouteName();
if( getenv("environment") === "master" && $rm == 'zfcuser' )
{
$ev->setRouteMatch( /* switch the route out here */ );
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment