Set route match
public setRouteMatch ( Zend\Router\RouteMatch $matches ) : |
||
$matches | Zend\Router\RouteMatch | |
return |
public function indexAction() { $event = $this->getEvent(); $routeMatch = new \Zend\Mvc\Router\Http\RouteMatch([ 'controller' => 'index', 'action' => 'index', ]); $event->setRouteMatch($routeMatch); // ... rest of the action logic ... }
event->getRouteMatch()->getParam('id') ?>In this example, we use the getRouteMatch method to retrieve the RouteMatch object from the MvcEvent instance. We can then use the getParam method to get a specific parameter value from the matched route. This code would typically be used in a view template to generate dynamic content based on the current request. The Zend Framework is a PHP package library.
public setRouteMatch ( Zend\Router\RouteMatch $matches ) : |
||
$matches | Zend\Router\RouteMatch | |
return |