44
55namespace Doctrine \ORM \Mapping ;
66
7+ use Doctrine \Deprecations \Deprecation ;
8+
79use function strtolower ;
810use function trim ;
911
@@ -127,6 +129,20 @@ public static function fromMappingArrayAndNamingStrategy(array $mappingArray, Na
127129 $ mapping ->joinTableColumns = [];
128130
129131 foreach ($ mapping ->joinTable ->joinColumns as $ joinColumn ) {
132+ if ($ joinColumn ->nullable !== null ) {
133+ Deprecation::trigger (
134+ 'doctrine/orm ' ,
135+ 'https://github/doctrine/orm/pull/12125 ' ,
136+ <<<'DEPRECATION'
137+ Specifying the "nullable" attribute for join columns in many-to-many associations (here, %s::$%s) is a no-op.
138+ The ORM will always set it to false.
139+ Doing so is deprecated and will be an error in 4.0.
140+ DEPRECATION,
141+ $ mapping ->sourceEntity ,
142+ $ mapping ->fieldName ,
143+ );
144+ }
145+
130146 $ joinColumn ->nullable = false ;
131147
132148 if (empty ($ joinColumn ->referencedColumnName )) {
@@ -152,6 +168,20 @@ public static function fromMappingArrayAndNamingStrategy(array $mappingArray, Na
152168 }
153169
154170 foreach ($ mapping ->joinTable ->inverseJoinColumns as $ inverseJoinColumn ) {
171+ if ($ inverseJoinColumn ->nullable !== null ) {
172+ Deprecation::trigger (
173+ 'doctrine/orm ' ,
174+ 'https://github/doctrine/orm/pull/12125 ' ,
175+ <<<'DEPRECATION'
176+ Specifying the "nullable" attribute for join columns in many-to-many associations (here, %s::$%s) is a no-op.
177+ The ORM will always set it to false.
178+ Doing so is deprecated and will be an error in 4.0.
179+ DEPRECATION,
180+ $ mapping ->targetEntity ,
181+ $ mapping ->fieldName ,
182+ );
183+ }
184+
155185 $ inverseJoinColumn ->nullable = false ;
156186
157187 if (empty ($ inverseJoinColumn ->referencedColumnName )) {
0 commit comments