@@ -9,30 +9,28 @@ i.e. attributes and associations metadata in particular. The example here shows
99the overriding of a class that uses a trait but is similar when extending a base
1010class as shown at the end of this tutorial.
1111
12- Suppose we have a class ExampleEntityWithOverride. This class uses trait ExampleTrait:
12+ Suppose we have a class `` ExampleEntityWithOverride `` . This class uses trait `` ExampleTrait `` :
1313
1414.. code-block :: php
1515
1616 <?php
1717
1818 #[Entity]
1919 #[AttributeOverrides([
20- new AttributeOverride('foo', [
21- 'column' => new Column([
22- 'name' => 'foo_overridden',
23- 'type' => 'integer',
24- 'length' => 140,
25- 'nullable' => false,
26- 'unique' => false,
27- ]),
28- ]),
20+ new AttributeOverride('foo', new Column(
21+ name: 'foo_overridden',
22+ type: 'integer',
23+ length: 140,
24+ nullable: false,
25+ unique: false,
26+ )),
2927 ])]
3028 #[AssociationOverrides([
3129 new AssociationOverride('bar', [
32- 'joinColumns' => new JoinColumn([
33- ' name' => 'example_entity_overridden_bar_id',
34- ' referencedColumnName' => 'id',
35- ] ),
30+ new JoinColumn(
31+ name: 'example_entity_overridden_bar_id',
32+ referencedColumnName: 'id',
33+ ),
3634 ]),
3735 ])]
3836 class ExampleEntityWithOverride
@@ -47,7 +45,7 @@ Suppose we have a class ExampleEntityWithOverride. This class uses trait Example
4745 private $id;
4846 }
4947
50- The docblock is showing metadata override of the attribute and association type. It
48+ `` #[AttributeOverrides] `` contains metadata override of the attribute and association type. It
5149basically changes the names of the columns mapped for a property ``foo `` and for
5250the association ``bar `` which relates to Bar class shown above. Here is the trait
5351which has mapping metadata that is overridden by the attribute above:
0 commit comments