Say I have a route like this:
$Map->connect('/transfer/listing/:source_warehouse_id/:dest_warehouse_id',
array('controller' => 'spots_transfers', 'action' => 'listing', 'source_warehouse_id' => OPTIONAL, 'dest_warehouse_id' => OPTIONAL ));
And I'm here "/transfer/listing/1/2"
What function could I use to return this array:
array('controller' => 'spots_transfers', 'action' => 'listing', 'source_warehouse_id' => 1, 'dest_warehouse_id' => 2 )
? I know that $this->params has all the right key => values, but it also has other data depending on how one arrived at the current page. Basically I'm looking for the opposite of UrlFor(). I'm certain a function for this exists, but I'm not having much luck finding it right now. Does someone know? Thanks!
AFAIR there's no such function in the trunk.
I've implemented AkRequest->getParametersFromRequestedUrl() which will exactly do what you need but thats in branches/new-router and can't be backported, more exactly I won't.
You could ask the Router to parametrize a given url again (AkRouter->toParams($url)) but this will break as soon as we merge.
Ahh, so the router is getting an upgrade. BTW: For backwards compatibility, why not link (AkRouter->toParams($url)) to the new (AkRequest->getParametersFromRequestedUrl())? I'm sure there's a good programming reason, just curious. :-)
the new router doesn't take an url (as string) but 'parametrizes' the request. f.i. it checks for the requested method (GET; PUT...) too.
That makes sense. Thanks.
1 to 5 of 5