I have a router defined like this
$router->add("/api/:controller/:action/:params", array(
'controller' => 1,
'action' => 2,
'params' => 3,
'myParameter' => 'test'
));
So, I can get that "myParameter" parameter inside of controller like this
$this->dispatcher->getParam("myParameter");
But, I want to use this parameter in another class I call from Controller. Something like
myCustomClass::test();
class myCustomClass {
function test() {
// this is where I need that parameter
}
}
Dispatcher returns nothing if I call it from myCustomClass
.
(Of course getting the value inside of controller and passing it as a value is a solution, but I will probably use it at least for 100 different actions, so it is not really a good solution in this case).
Is there a way of getting that extra parameter outside of the scope of controller.