Skip to content

Commit 9402f9e

Browse files
authored
Fix docs examples for mappings overrides (#11770)
1 parent f91da5b commit 9402f9e

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

docs/en/tutorials/override-field-association-mappings-in-subclasses.rst

+13-15
Original file line numberDiff line numberDiff line change
@@ -9,30 +9,28 @@ i.e. attributes and associations metadata in particular. The example here shows
99
the overriding of a class that uses a trait but is similar when extending a base
1010
class 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
5149
basically changes the names of the columns mapped for a property ``foo`` and for
5250
the association ``bar`` which relates to Bar class shown above. Here is the trait
5351
which has mapping metadata that is overridden by the attribute above:

0 commit comments

Comments
 (0)