Skip to content

Instantly share code, notes, and snippets.

@NandoKstroNet
Created December 6, 2017 21:34
Show Gist options
  • Save NandoKstroNet/c22f65be250a9f505c3d70abbde8a05a to your computer and use it in GitHub Desktop.
Save NandoKstroNet/c22f65be250a9f505c3d70abbde8a05a to your computer and use it in GitHub Desktop.
Utilizando templates twig em nosso controller Symfony 4, post sobre templates no Symfony 4 - Blog Code Experts Learning blog.codeexpertslearning.com.br
<?php
namespace App\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use App\Entity\Product;
class ProductController extends AbstractController
{
/**
* @Route("/", name="product_home")
*/
public function index()
{
$products = $this->getDoctrine()
->getRepository(Product::class)
->findAll();
return $this->render('products/index.html.twig',[
'products' => $products
]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment