Error when trying to recover object from database
According to Symfony2 documentation, I can access to instances in database
with the next code:
public function showAction($id)
{
$producto = $this->getDoctrine()
->getRepository('AcmeGuardaBundle:Producto')
->find($id);
$nombreCategoria = $producto->getCategoria()->getNombre();
// ...
}
However, I try to do:
$imagen = $this->getDoctrine()
->getRepository('MSDHomeBundle:Imagen')
->find($_SESSION['id']);
and I get the next error in the browser:
Parse error: syntax error, unexpected ':' in
/home/manolo/MiServer/itransformer-2.0/src/MSD/HomeBundle/Controller/HomeController.php
on line 219
What am I doing wrong? Imagen is a class stored in database, and
persisting data works right.
No comments:
Post a Comment