From e955ae85f7ff90e2f131d372968ebeb238a96f34 Mon Sep 17 00:00:00 2001 From: Jesse Rushlow Date: Mon, 1 Aug 2022 14:24:22 -0400 Subject: [PATCH] [Doctrine] show attributes for make:entity in association docs --- doctrine/associations.rst | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/doctrine/associations.rst b/doctrine/associations.rst index 470e48059f2..0468b03becd 100644 --- a/doctrine/associations.rst +++ b/doctrine/associations.rst @@ -68,19 +68,16 @@ This will generate your new entity class:: // ... + #[ORM\Entity(repositoryClass: CategoryRepository::class)] class Category { - /** - * @ORM\Id - * @ORM\GeneratedValue - * @ORM\Column(type="integer") - */ + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column] private $id; - /** - * @ORM\Column(type="string") - */ - private $name; + #[ORM\Column] + private string $name; // ... getters and setters } @@ -380,12 +377,11 @@ Now you can see this new code in action! Imagine you're inside a controller:: use App\Entity\Product; use Doctrine\Persistence\ManagerRegistry; use Symfony\Component\HttpFoundation\Response; + use Symfony\Component\Routing\Annotation\Route; class ProductController extends AbstractController { - /** - * @Route("/product", name="product") - */ + #[Route('/product', name: 'product')] public function index(ManagerRegistry $doctrine): Response { $category = new Category();