I did not get any response from Google either for my question, so I asked if I asked the relevant URL reference Is there an easy way to get route advice?
I'm in the context of the action of an administrator, so I'm getting the context by using $ request and $ response objects I actually use the following I:
$ referer = $ request- & gt; GetHeader ('Referrer'); $ RefererUri = $ referer-> GetUri ();
What I really have to do is to know that if the URL I got in the $ refererUri variable matches the path in which "Connects" Defined as the ultimate right, the path is defined as the following:
'productAdd '= & Gt; Array ('type' = & gt; verb ',' option '=> array (' path '=> gtk;' / product / add ',' error '=> array (' controller '= & gt; ; 'Spec' = & gt; '/ add',);), 'admin' \ 'product', 'verb' = & gt; 'add', 'connect' => Code> Now I have a URL in my $ refererUri variable like
http://local.example.com/dir/product/add
I already thought that the solution is to request a request object from the URL and then order an object from an object Area to which will tell me that it matches or not. Then if I get a root match object in return, then I can get the value of the ultimate I want.
But it looks really great for testing very quickly, and it seems that I can not get it because a root is not an object which I can easily get started.
Any thoughts?
Edit: I found: I looked closer to what I had asked, but the first answer has been proposed that I'm not coming from the $ routestack object. Any clues?
I have finally reached my goal, so I posted the answer to help others in the same I am doing the situation: -)
What I did is basically:
-
Getting a Referrer URI:
$ referer = $ Request-> getHeader ('Referrer'); $ RefererUri = $ referer-> getUri ();
-
Instanciating a request from this URL:
$ refererRequest = new request (); $ RefererRequest-> setUri ($ refererUri);
-
Obtain the router object:
$ routestack = $ service manager-> get ('router');
-
$ matchstack-> match ($ refererRequest); -
My parameter value was found in the Rootmail object:
if ($ match instanceof routout match) {$ route = $ match-> getMatchedRouteName ( ); $ Connect = $ match-> peparam ('connect'); }
And there it is; -)
Comments
Post a Comment