@@ -9,30 +9,28 @@ i.e. attributes and associations metadata in particular. The example here shows
9
9
the overriding of a class that uses a trait but is similar when extending a base
10
10
class as shown at the end of this tutorial.
11
11
12
- Suppose we have a class ExampleEntityWithOverride. This class uses trait ExampleTrait:
12
+ Suppose we have a class `` ExampleEntityWithOverride `` . This class uses trait `` ExampleTrait `` :
13
13
14
14
.. code-block :: php
15
15
16
16
<?php
17
17
18
18
#[Entity]
19
19
#[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
+ )),
29
27
])]
30
28
#[AssociationOverrides([
31
29
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
+ ),
36
34
]),
37
35
])]
38
36
class ExampleEntityWithOverride
@@ -47,7 +45,7 @@ Suppose we have a class ExampleEntityWithOverride. This class uses trait Example
47
45
private $id;
48
46
}
49
47
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
51
49
basically changes the names of the columns mapped for a property ``foo `` and for
52
50
the association ``bar `` which relates to Bar class shown above. Here is the trait
53
51
which has mapping metadata that is overridden by the attribute above:
0 commit comments