Is it possible to retrieve the html code generated from controller A within controller B?
Controller A
/**
*
*
* @Route("/{user_id}/cart", name="user_cart")
* @Template()
*/
public function showCartAction($user_id)
{
$cart = $this->getCartManager()
->getUserCart($user_id);
return array(
'cart'=> cart
);
}
Controller B
/**
*
*
* @Route("/html", name="htmlGenerated")
* @Template()
*/
public function showHTMLAction()
{
$user_id = 3;
$html = //How to obtain the html generated by Controller A with UserId = 3 ????
//...
}
You could forward the request in Controller B
Even though this should work perfectly fine, I would actually advise you to embed the controller in your template instead.