|
17 | 17 | use Doctrine\Common\Collections\Collection; |
18 | 18 | use Doctrine\ORM\Mapping as ORM; |
19 | 19 |
|
20 | | -/** |
21 | | - * @ORM\Entity |
22 | | - * @ORM\Table(name="book") |
23 | | - */ |
| 20 | +#[ORM\Entity] |
| 21 | +#[ORM\Table(name: 'book')] |
24 | 22 | class Book |
25 | 23 | { |
26 | | - /** |
27 | | - * @ORM\Id |
28 | | - * @ORM\Column(type="integer", name="book_id") |
29 | | - */ |
| 24 | + #[ORM\Id] |
| 25 | + #[ORM\Column(type: 'integer', name: 'book_id')] |
30 | 26 | protected $bookId; |
31 | 27 |
|
32 | | - /** |
33 | | - * @ORM\Column(type="string", length=255) |
34 | | - */ |
| 28 | + #[ORM\Column(type: 'string', length: 255)] |
35 | 29 | protected $title; |
36 | 30 |
|
37 | | - /** |
38 | | - * @ORM\ManyToOne(targetEntity="Ecommit\DoctrineOrmRefetch\Tests\App\Entity\Category", inversedBy="books") |
39 | | - * @ORM\JoinColumn(name="category_id", referencedColumnName="category_id", nullable=false) |
40 | | - */ |
| 31 | + #[ORM\ManyToOne(targetEntity: Category::class, inversedBy: 'books')] |
| 32 | + #[ORM\JoinColumn(name: 'category_id', referencedColumnName: 'category_id', nullable: false)] |
41 | 33 | protected $category; |
42 | 34 |
|
43 | | - /** |
44 | | - * @ORM\ManyToMany(targetEntity="Ecommit\DoctrineOrmRefetch\Tests\App\Entity\Author", inversedBy="books") |
45 | | - * @ORM\JoinTable(name="book_author", |
46 | | - * joinColumns={@ORM\JoinColumn(name="book_id", referencedColumnName="book_id")}, |
47 | | - * inverseJoinColumns={@ORM\JoinColumn(name="author_id", referencedColumnName="author_id")} |
48 | | - * ) |
49 | | - */ |
| 35 | + #[ORM\ManyToMany(targetEntity: Author::class, inversedBy: 'books')] |
| 36 | + #[ORM\JoinColumn(name: 'book_id', referencedColumnName: 'book_id')] |
| 37 | + #[ORM\InverseJoinColumn(name: 'author_id', referencedColumnName: 'author_id')] |
50 | 38 | protected $authors; |
51 | 39 |
|
52 | | - /** |
53 | | - * @ORM\OneToMany(targetEntity="Ecommit\DoctrineOrmRefetch\Tests\App\Entity\Sale", mappedBy="book") |
54 | | - */ |
| 40 | + #[ORM\OneToMany(targetEntity: Sale::class, mappedBy: 'book')] |
55 | 41 | protected $sales; |
56 | 42 |
|
57 | 43 | public function __construct() |
|
0 commit comments