Skip to content

Commit 2e349c9

Browse files
committed
Merge branch '6.1' into 6.2
* 6.1: [Doctrine] show attributes for make:entity in association docs
2 parents 8f9a36d + 9dae630 commit 2e349c9

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

doctrine/associations.rst

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff 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();

0 commit comments

Comments
 (0)