I am trying to add a global parameter
Parameter for all routes and parameter settings in the Request Listener kernel.
routing
mea_crm:
resource: @Crm4Bundle/Resources/config/routing.yml
prefix: /{_applicationid}
defaults: { _applicationid: 0 }
requirements:
_applicationid: |0|1|2|3|4|5|6
in the receiver - { name: kernel.event_listener, event: kernel.request, method: onKernelRequest }
I am trying to configure this parameter
$request->attributes->add(array(
'_applicationid'=>$appCurrentId
));
$request->query->add(
array(
'_applicationid'=>$appCurrentId
)
);
$request->query->set('_applicationid',$appCurrentId);
and still there in routes - the default value is 0
Update 1 i tune the listener to the highest priority
tags:
- { name: kernel.event_listener, event: kernel.request, method: onKernelRequest, priority: 255 }
in the listener setting
public function onKernelRequest(GetResponseEvent $event)
{
$event->getRequest()->request->set('_applicationid',1);
return ;
and this parameter has not yet been specified.
UPDATE 2
its weird - I dump in Symfony \ Component \ Routing \ Router
in the method
public function matchRequest(Request $request)
....
var_dump($matcher->matchRequest($request));
die();
and get
( = 4) '_controller' = > string 'Mea\TaskBundle\Controller\TaskListController:: viewOneAction' (length = 59) '_applicationid' = > string '1' (length = 1) 'id' = > '700' ( = 3) '_route' = > 'MeaTask_View' ( = 12)
_applicationid
URL-
routing.yml
mea_crm:
resource: @MeaCrm4Bundle/Resources/config/routing.yml
prefix: /{_applicationid}
defaults: { _applicationid: null }
requirements:
_applicationid: |1|2|3|4|5|6
, : http://crm4.dev/app_dev.php//u/logs/list
?
3
php app/console debug:event-dispatcher kernel.request
Registered Listeners for "kernel.request" Event
===============================================
------- ---------------------------------------------------------------------------------- ----------
Order Callable Priority
------- ---------------------------------------------------------------------------------- ----------
------- ---------------------------------------------------------------------------------- ----------
CrmApplicationRequestListener:: onKernelRequestInit
i onKernelRequestInit .
: {_applicationid: 0}
, symfony, _applicationid: 0 _applicationid, .
_applicationid . . , .
4
-
symfony2 ,