In controller I can get parameters from route using $this->params()->fromRoute('param1')
How can I do that in Module OnBootstrap() function?
namespace MyModule;
use Zend\EventManager\EventInterface;
class Module
{
public function onBootstrap(EventInterface $event)
{
// here I need to get parameter from route
}
}
As user2257808 said in his comment, onBootstrap is called before routing takes place, so there is not any RouteMatch to get. He suggested attaching to EVENT_RENDER, that may be too late in your case.
I would do something like this, attaching to
MvcEvent::EVENT_DISPATCH
.MyModule\Module.php