Witam wszystkich. mam maly problem z funkcja wyswietlania produktu w symfony nie mam pojecia co mam tutaj zle czy ktos mogl by mi to wytlumaczyc?
adress ktory podaje :
http://localhost:8000/show/id=2
funkcje:
/**
* @Route("/create")
*/
public function createAction()
{
$product = new Product();
$product->setName('Frytki');
$product->setPrice(5.20);
$em = $this->getDoctrine()->getManager();
$em->persist($product);
$em->flush();
return new Response('Product added succesfully '.$product->getId(),200);
}
/**
* @Route("/show/{id}")
* @Template
*/
public function showAction($id)
{
$product = $this->getDoctrine()
->getRepository('TrainingBundle:Product')
->find($id);
if(!$product)
{
throw $this->createNotFoundException('Product not Found!');
}
return array('product'=>$product);
}
przy Dodaniu produktu wyskakuje komunikat ze produkt zostal dodany pomyslnie i jak sprawdzilem w bazie danych to naprawde on istnieje