Skip to content

Commit fff085b

Browse files
authored
Fix documentation for JoinColumn nullable (#11798)
Nullability is not inherited from the PHP type. The change that enabled this feature was reversed in #8732.
1 parent 5ad5b11 commit fff085b

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

docs/en/reference/association-mapping.rst

+3-5
Original file line numberDiff line numberDiff line change
@@ -1368,8 +1368,7 @@ defaults to "id", just as in one-to-one or many-to-one mappings.
13681368

13691369
Additionally, when using typed properties with Doctrine 2.9 or newer
13701370
you can skip ``targetEntity`` in ``ManyToOne`` and ``OneToOne``
1371-
associations as they will be set based on type. Also ``nullable``
1372-
attribute on ``JoinColumn`` will be inherited from PHP type. So that:
1371+
associations as they will be set based on type. So that:
13731372

13741373
.. configuration-block::
13751374

@@ -1409,7 +1408,7 @@ Is essentially the same as following:
14091408
<?php
14101409
/** One Product has One Shipment. */
14111410
#[OneToOne(targetEntity: Shipment::class)]
1412-
#[JoinColumn(name: 'shipment_id', referencedColumnName: 'id', nullable: false)]
1411+
#[JoinColumn(name: 'shipment_id', referencedColumnName: 'id')]
14131412
private Shipment $shipment;
14141413
14151414
.. code-block:: annotation
@@ -1418,7 +1417,7 @@ Is essentially the same as following:
14181417
/**
14191418
* One Product has One Shipment.
14201419
* @OneToOne(targetEntity="Shipment")
1421-
* @JoinColumn(name="shipment_id", referencedColumnName="id", nullable=false)
1420+
* @JoinColumn(name="shipment_id", referencedColumnName="id")
14221421
*/
14231422
private Shipment $shipment;
14241423
@@ -1442,7 +1441,6 @@ Is essentially the same as following:
14421441
joinColumn:
14431442
name: shipment_id
14441443
referencedColumnName: id
1445-
nullable: false
14461444
14471445
If you accept these defaults, you can reduce the mapping code to a
14481446
minimum.

0 commit comments

Comments
 (0)