Skip to content

Commit 88d2d2d

Browse files
committed
Fix association mapping docs (closes #11797)
1 parent af9a626 commit 88d2d2d

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

docs/en/reference/association-mapping.rst

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -901,9 +901,11 @@ join columns default to the simple, unqualified class name of the
901901
targeted class followed by "\_id". The referencedColumnName always
902902
defaults to "id", just as in one-to-one or many-to-one mappings.
903903

904-
Additionally, when using typed properties with Doctrine 2.9 or newer
904+
Additionally, when using typed properties with ORM 2.9 or newer
905905
you can skip ``targetEntity`` in ``ManyToOne`` and ``OneToOne``
906-
associations as they will be set based on type. So that:
906+
associations as they will be set based on type. Also with ORM 3.4
907+
or newer, ``nullable`` attribute on ``JoinColumn`` will be inherited
908+
from PHP type. So that:
907909

908910
.. configuration-block::
909911

@@ -930,7 +932,7 @@ Is essentially the same as following:
930932
<?php
931933
/** One Product has One Shipment. */
932934
#[OneToOne(targetEntity: Shipment::class)]
933-
#[JoinColumn(name: 'shipment_id', referencedColumnName: 'id')]
935+
#[JoinColumn(name: 'shipment_id', referencedColumnName: 'id', nullable: false)]
934936
private Shipment $shipment;
935937
936938
.. code-block:: annotation
@@ -939,7 +941,7 @@ Is essentially the same as following:
939941
/**
940942
* One Product has One Shipment.
941943
* @OneToOne(targetEntity="Shipment")
942-
* @JoinColumn(name="shipment_id", referencedColumnName="id")
944+
* @JoinColumn(name="shipment_id", referencedColumnName="id", nullable=false)
943945
*/
944946
private Shipment $shipment;
945947
@@ -948,7 +950,7 @@ Is essentially the same as following:
948950
<doctrine-mapping>
949951
<entity class="Product">
950952
<one-to-one field="shipment" target-entity="Shipment">
951-
<join-column name="shipment_id" referenced-column-name="id" nulable=false />
953+
<join-column name="shipment_id" referenced-column-name="id" nullable=false />
952954
</one-to-one>
953955
</entity>
954956
</doctrine-mapping>

0 commit comments

Comments
 (0)