Skip to content

Instantly share code, notes, and snippets.

@leopro
Created August 6, 2012 16:29
Show Gist options
  • Save leopro/3276236 to your computer and use it in GitHub Desktop.
Save leopro/3276236 to your computer and use it in GitHub Desktop.
<?php
use Symfony\Component\HttpFoundation\Response;
public function showAction($id)
{
$repository = $this->getDoctrine()->getRepository('AcmeHelloBundle:Product');
$product = $repository->find($id);
if (!$product) {
throw $this->createNotFoundException('Nessun prodotto trovato per num id: '.$id);
}
return new Response($product->getQualcosa());
oppure
return $this->render('AcmeHelloBundle:Hello:show.html.twig', array('product' => $product));
}
http://symfony.com/it/doc/current/book/controller.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment