Skip to content

Instantly share code, notes, and snippets.

@weaverryan
Created February 7, 2018 15:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save weaverryan/1578778d6f826f2d820e34e1f71ce863 to your computer and use it in GitHub Desktop.
Save weaverryan/1578778d6f826f2d820e34e1f71ce863 to your computer and use it in GitHub Desktop.
<?php
namespace App\Controller;
use App\Repository\ProdutoRepository;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
class ProdutoController extends Controller
{
/**
* @Route("/produto", name="produto")
*/
public function index(ProductoRepository $repo)
{
$em = $this
->getDoctrine()
->getManager();
$produtos = $repo->findAll();
return $this->render("produtos/index.html.twig", ['produtos' => $produtos]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment