I made two bundles. I have created an action method in each of their respective controllers.
I am trying to get result of A in B.
I have attempted to include the content of the view of what A generates in B but my include ends up missing a variable therefore I retrieve the result from forwarding it.
I read the documentation and decided to use $variable=$this->forwad(MyControllerA)
but my $variable
doesn't get any result when I read the data in the view.
I was wondering as I found no similar issue if I am doing something wrong or if I should do this differently.
Code
public function getAAction()
{
$em = $this->getDoctrine()->getManager();
$list_A = $em->getRepository('ABundle:A_Entity')->findAll();
return $list_A;
}
public function getBAction()
{
$em = $this->getDoctrine()->getManager();
$list_B = $em->getRepository('PropertyBundle:B_Entity')->findAll();
$list_A = $this->forward('A_Bundle:A_Entity:getA');
return $this->render('@B/B/getB.html.twig', array('list_B' => $list_B, 'list_A' => $list_A));
}