From 9402f9e0f79f32cf501bd107201e6dfbf4dd8317 Mon Sep 17 00:00:00 2001 From: HypeMC <2445045+HypeMC@users.noreply.github.com> Date: Wed, 18 Dec 2024 20:41:44 +0100 Subject: [PATCH] Fix docs examples for mappings overrides (#11770) --- ...eld-association-mappings-in-subclasses.rst | 28 +++++++++---------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/docs/en/tutorials/override-field-association-mappings-in-subclasses.rst b/docs/en/tutorials/override-field-association-mappings-in-subclasses.rst index 0488c25e464..b7f74adf387 100644 --- a/docs/en/tutorials/override-field-association-mappings-in-subclasses.rst +++ b/docs/en/tutorials/override-field-association-mappings-in-subclasses.rst @@ -9,7 +9,7 @@ i.e. attributes and associations metadata in particular. The example here shows the overriding of a class that uses a trait but is similar when extending a base class as shown at the end of this tutorial. -Suppose we have a class ExampleEntityWithOverride. This class uses trait ExampleTrait: +Suppose we have a class ``ExampleEntityWithOverride``. This class uses trait ``ExampleTrait``: .. code-block:: php @@ -17,22 +17,20 @@ Suppose we have a class ExampleEntityWithOverride. This class uses trait Example #[Entity] #[AttributeOverrides([ - new AttributeOverride('foo', [ - 'column' => new Column([ - 'name' => 'foo_overridden', - 'type' => 'integer', - 'length' => 140, - 'nullable' => false, - 'unique' => false, - ]), - ]), + new AttributeOverride('foo', new Column( + name: 'foo_overridden', + type: 'integer', + length: 140, + nullable: false, + unique: false, + )), ])] #[AssociationOverrides([ new AssociationOverride('bar', [ - 'joinColumns' => new JoinColumn([ - 'name' => 'example_entity_overridden_bar_id', - 'referencedColumnName' => 'id', - ]), + new JoinColumn( + name: 'example_entity_overridden_bar_id', + referencedColumnName: 'id', + ), ]), ])] class ExampleEntityWithOverride @@ -47,7 +45,7 @@ Suppose we have a class ExampleEntityWithOverride. This class uses trait Example private $id; } -The docblock is showing metadata override of the attribute and association type. It +``#[AttributeOverrides]`` contains metadata override of the attribute and association type. It basically changes the names of the columns mapped for a property ``foo`` and for the association ``bar`` which relates to Bar class shown above. Here is the trait which has mapping metadata that is overridden by the attribute above: