Reputation: 8279
I want to perform a sub-request, but don't have the route in the format $this->forward() expects - I only have the url as a string.
// Symfony2 wants...
$this->forward('ProjectCustomerBundle:Customer:view', array('id' => 1234));
// I want...
$this->forward('customer/view/1234');
Surely I can manually build a Route or Request object from the url to achieve this? I've got a sneaky suspicion that I'm missing something obvious here...
Upvotes: 3
Views: 2635
Reputation: 508
https://github.com/Cosmologist/SymfonyCommonBundle#routing-utils
return $this->httpKernel->handle(Request::create($uri), HttpKernelInterface::SUB_REQUEST);
Upvotes: 0
Reputation: 1093
Use $this->get('router')->match('customer/view/1234')
and you should get an array with _controller
value and all other route parameters you need to pass.
Upvotes: 4