Skip to content

Commit 628ac3b

Browse files
Merge pull request #558 from MrYamous/doc/add-attributes-example
Add attributes example for entity in documentation
2 parents b9712ed + ab2a5b5 commit 628ac3b

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

Resources/doc/index.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,26 @@ for Doctrine's ORM:
311311

312312
.. configuration-block::
313313

314+
.. code-block:: php-attributes
315+
316+
// src/Entity/User.php
317+
namespace App\Entity;
318+
319+
use Doctrine\DBAL\Types\Types;
320+
use Doctrine\ORM\Mapping as ORM;
321+
322+
#[Entity]
323+
#[Table(name: 'user')]
324+
class User
325+
{
326+
#[ORM\Id]
327+
#[ORM\GeneratedValue(strategy: 'AUTO')]
328+
#[ORM\Column(type: Types:INT)]
329+
private $id;
330+
331+
#[ORM\Column(type: Types:STRING, length: 255)]
332+
private $name;
333+
314334
.. code-block:: php-annotations
315335
316336
// src/Entity/User.php

0 commit comments

Comments
 (0)