File tree Expand file tree Collapse file tree 1 file changed +8
-12
lines changed Expand file tree Collapse file tree 1 file changed +8
-12
lines changed Original file line number Diff line number Diff line change @@ -68,19 +68,16 @@ This will generate your new entity class::
6868
6969 // ...
7070
71+ #[ORM\Entity(repositoryClass: CategoryRepository::class)]
7172 class Category
7273 {
73- /**
74- * @ORM\Id
75- * @ORM\GeneratedValue
76- * @ORM\Column(type="integer")
77- */
74+ #[ORM\Id]
75+ #[ORM\GeneratedValue]
76+ #[ORM\Column]
7877 private $id;
7978
80- /**
81- * @ORM\Column(type="string")
82- */
83- private $name;
79+ #[ORM\Column]
80+ private string $name;
8481
8582 // ... getters and setters
8683 }
@@ -380,12 +377,11 @@ Now you can see this new code in action! Imagine you're inside a controller::
380377 use App\Entity\Product;
381378 use Doctrine\Persistence\ManagerRegistry;
382379 use Symfony\Component\HttpFoundation\Response;
380+ use Symfony\Component\Routing\Annotation\Route;
383381
384382 class ProductController extends AbstractController
385383 {
386- /**
387- * @Route("/product", name="product")
388- */
384+ #[Route('/product', name: 'product')]
389385 public function index(ManagerRegistry $doctrine): Response
390386 {
391387 $category = new Category();
You can’t perform that action at this time.
0 commit comments