0
I’m using the Symfony2, I’m still getting familiar with this framework. And when using my controller I’m not sure how to pick up the output generated by it and play for a string. I need to play for a string to treat because I’m using the pjax and if the request is a request originated by pjax i need to send only a snippet of the page (the content I want to modify), to do this I intend to use the Crawler and thus return only the correct content, depending on the situation. The problem is that I don’t know how to capture the HTML that the Controller generates.
<?php
/**
* State controller.
*
* @Route("/state")
*/
class StateController extends Controller {
/**
* Lists all State entities.
*
* @Route("/", name="state")
* @Method("GET")
* @Template()
*/
public function indexAction() {
$em = $this->getDoctrine()->getManager();
$entities = $em->getRepository('AmbulatoryBundle:State')->findAll();
$rendered = $this->render('TestBundle:State:index.html.twig', array(
'entities' => $entities,
));
return $rendered; // Preciso pegar o conteúdo gerado aqui em string
}
?>