I made a web-application with symfony2, where a registrated user can query for a file and visualize it. I'm trying to pass the information from the controller to the template.
When I pass the information of a single object, it works properly. You can see the controller here:
public function showAction($id)
{
$product = $this->getDoctrine()
->getRepository('AcmeBundle:Product')
->find($id);
if (!$product) {
throw $this->createNotFoundException(
'Nessun prodotto trovato per l\'id '.$id
);
}
return $this->render('AcmeGroundStationBundle::showdata.html.twig', array('Id' => $product->getId(), 'Name' => $product->getName(), 'UploadTime'=> $product- >getUploadTime()));
}
But what can I do if I want to display the whole list? If I change the
->find($id);
with
->findAll();
of course I get error.
( Call to a member function getId() on a non-object).
How can I display the whole list?
Thank you for your help