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::
68
68
69
69
// ...
70
70
71
+ #[ORM\Entity(repositoryClass: CategoryRepository::class)]
71
72
class Category
72
73
{
73
- /**
74
- * @ORM\Id
75
- * @ORM\GeneratedValue
76
- * @ORM\Column(type="integer")
77
- */
74
+ #[ORM\Id]
75
+ #[ORM\GeneratedValue]
76
+ #[ORM\Column]
78
77
private $id;
79
78
80
- /**
81
- * @ORM\Column(type="string")
82
- */
83
- private $name;
79
+ #[ORM\Column]
80
+ private string $name;
84
81
85
82
// ... getters and setters
86
83
}
@@ -380,12 +377,11 @@ Now you can see this new code in action! Imagine you're inside a controller::
380
377
use App\Entity\Product;
381
378
use Doctrine\Persistence\ManagerRegistry;
382
379
use Symfony\Component\HttpFoundation\Response;
380
+ use Symfony\Component\Routing\Annotation\Route;
383
381
384
382
class ProductController extends AbstractController
385
383
{
386
- /**
387
- * @Route("/product", name="product")
388
- */
384
+ #[Route('/product', name: 'product')]
389
385
public function index(ManagerRegistry $doctrine): Response
390
386
{
391
387
$category = new Category();
You can’t perform that action at this time.
0 commit comments