3535use ApiPlatform \Metadata \Property \PropertyNameCollection ;
3636use Doctrine \ORM \EntityManager ;
3737use Doctrine \ORM \Mapping \ClassMetadata ;
38+ use Doctrine \ORM \Mapping \JoinColumn ;
3839use Doctrine \ORM \Query \Expr \Join ;
3940use Doctrine \ORM \QueryBuilder ;
4041use PHPUnit \Framework \TestCase ;
@@ -94,8 +95,8 @@ public function testApplyToCollection(): void
9495
9596 $ classMetadataProphecy = $ this ->prophesize (ClassMetadata::class);
9697 $ classMetadataProphecy ->associationMappings = [
97- 'relatedDummy ' => ['fetch ' => ClassMetadata::FETCH_EAGER , 'joinColumns ' => [[ ' nullable ' => true ] ], 'targetEntity ' => RelatedDummy::class],
98- 'relatedDummy2 ' => ['fetch ' => ClassMetadata::FETCH_EAGER , 'joinColumns ' => [[ ' nullable ' => false ] ], 'targetEntity ' => RelatedDummy::class],
98+ 'relatedDummy ' => ['fetch ' => ClassMetadata::FETCH_EAGER , 'joinColumns ' => [new JoinColumn ( nullable: true ) ], 'targetEntity ' => RelatedDummy::class],
99+ 'relatedDummy2 ' => ['fetch ' => ClassMetadata::FETCH_EAGER , 'joinColumns ' => [new JoinColumn ( nullable: false ) ], 'targetEntity ' => RelatedDummy::class],
99100 ];
100101
101102 $ relatedClassMetadataProphecy = $ this ->prophesize (ClassMetadata::class);
@@ -181,9 +182,9 @@ public function testApplyToItem(): void
181182
182183 $ classMetadataProphecy = $ this ->prophesize (ClassMetadata::class);
183184 $ classMetadataProphecy ->associationMappings = [
184- 'relatedDummy ' => ['fetch ' => ClassMetadata::FETCH_EAGER , 'joinColumns ' => [[ ' nullable ' => true ] ], 'targetEntity ' => RelatedDummy::class],
185- 'relatedDummy2 ' => ['fetch ' => ClassMetadata::FETCH_EAGER , 'joinColumns ' => [[ ' nullable ' => false ] ], 'targetEntity ' => UnknownDummy::class],
186- 'relatedDummy3 ' => ['fetch ' => ClassMetadata::FETCH_EAGER , 'joinTable ' => ['joinColumns ' => [[ ' nullable ' => false ] ]], 'targetEntity ' => UnknownDummy::class],
185+ 'relatedDummy ' => ['fetch ' => ClassMetadata::FETCH_EAGER , 'joinColumns ' => [new JoinColumn ( nullable: true ) ], 'targetEntity ' => RelatedDummy::class],
186+ 'relatedDummy2 ' => ['fetch ' => ClassMetadata::FETCH_EAGER , 'joinColumns ' => [new JoinColumn ( nullable: false ) ], 'targetEntity ' => UnknownDummy::class],
187+ 'relatedDummy3 ' => ['fetch ' => ClassMetadata::FETCH_EAGER , 'joinTable ' => ['joinColumns ' => [new JoinColumn ( nullable: false ) ]], 'targetEntity ' => UnknownDummy::class],
187188 'relatedDummy4 ' => ['fetch ' => ClassMetadata::FETCH_EAGER , 'targetEntity ' => UnknownDummy::class],
188189 'relatedDummy5 ' => ['fetch ' => ClassMetadata::FETCH_LAZY , 'targetEntity ' => UnknownDummy::class],
189190 'singleInheritanceRelation ' => ['fetch ' => ClassMetadata::FETCH_EAGER , 'targetEntity ' => AbstractDummy::class],
@@ -200,7 +201,7 @@ public function testApplyToItem(): void
200201 $ relatedClassMetadataProphecy ->hasField ('embeddedDummy.name ' )->willReturn (true )->shouldBeCalled ();
201202
202203 $ relatedClassMetadataProphecy ->associationMappings = [
203- 'relation ' => ['fetch ' => ClassMetadata::FETCH_EAGER , 'joinColumns ' => [[ ' nullable ' => false ] ], 'targetEntity ' => UnknownDummy::class],
204+ 'relation ' => ['fetch ' => ClassMetadata::FETCH_EAGER , 'joinColumns ' => [new JoinColumn ( nullable: false ) ], 'targetEntity ' => UnknownDummy::class],
204205 'thirdLevel ' => ['fetch ' => ClassMetadata::FETCH_EAGER , 'targetEntity ' => ThirdLevel::class, 'sourceEntity ' => RelatedDummy::class, 'inversedBy ' => 'relatedDummies ' , 'type ' => ClassMetadata::TO_ONE ],
205206 ];
206207
@@ -361,13 +362,13 @@ public function testMaxJoinsReached(): void
361362
362363 $ classMetadataProphecy = $ this ->prophesize (ClassMetadata::class);
363364 $ classMetadataProphecy ->associationMappings = [
364- 'relatedDummy ' => ['fetch ' => ClassMetadata::FETCH_EAGER , 'joinColumns ' => [[ ' nullable ' => false ] ], 'targetEntity ' => RelatedDummy::class],
365+ 'relatedDummy ' => ['fetch ' => ClassMetadata::FETCH_EAGER , 'joinColumns ' => [new JoinColumn ( nullable: false ) ], 'targetEntity ' => RelatedDummy::class],
365366 ];
366367 $ classMetadataProphecy ->hasField ('relatedDummy ' )->willReturn (true );
367368
368369 $ relatedClassMetadataProphecy = $ this ->prophesize (ClassMetadata::class);
369370 $ relatedClassMetadataProphecy ->associationMappings = [
370- 'dummy ' => ['fetch ' => ClassMetadata::FETCH_EAGER , 'joinColumns ' => [[ ' nullable ' => false ] ], 'targetEntity ' => Dummy::class],
371+ 'dummy ' => ['fetch ' => ClassMetadata::FETCH_EAGER , 'joinColumns ' => [new JoinColumn ( nullable: false ) ], 'targetEntity ' => Dummy::class],
371372 ];
372373 $ relatedClassMetadataProphecy ->hasField ('dummy ' )->willReturn (true );
373374
@@ -410,13 +411,13 @@ public function testMaxDepth(): void
410411
411412 $ classMetadataProphecy = $ this ->prophesize (ClassMetadata::class);
412413 $ classMetadataProphecy ->associationMappings = [
413- 'relatedDummy ' => ['fetch ' => ClassMetadata::FETCH_EAGER , 'joinColumns ' => [[ ' nullable ' => false ] ], 'targetEntity ' => RelatedDummy::class],
414+ 'relatedDummy ' => ['fetch ' => ClassMetadata::FETCH_EAGER , 'joinColumns ' => [new JoinColumn ( nullable: false ) ], 'targetEntity ' => RelatedDummy::class],
414415 ];
415416 $ classMetadataProphecy ->hasField ('relatedDummy ' )->willReturn (true );
416417
417418 $ relatedClassMetadataProphecy = $ this ->prophesize (ClassMetadata::class);
418419 $ relatedClassMetadataProphecy ->associationMappings = [
419- 'dummy ' => ['fetch ' => ClassMetadata::FETCH_EAGER , 'joinColumns ' => [[ ' nullable ' => false ] ], 'targetEntity ' => Dummy::class],
420+ 'dummy ' => ['fetch ' => ClassMetadata::FETCH_EAGER , 'joinColumns ' => [new JoinColumn ( nullable: false ) ], 'targetEntity ' => Dummy::class],
420421 ];
421422 $ relatedClassMetadataProphecy ->hasField ('dummy ' )->willReturn (true );
422423
@@ -471,7 +472,7 @@ public function testForceEager(): void
471472
472473 $ classMetadataProphecy = $ this ->prophesize (ClassMetadata::class);
473474 $ classMetadataProphecy ->associationMappings = [
474- 'relation ' => ['fetch ' => ClassMetadata::FETCH_LAZY , 'targetEntity ' => UnknownDummy::class, 'joinColumns ' => [[ ' nullable ' => false ] ]],
475+ 'relation ' => ['fetch ' => ClassMetadata::FETCH_LAZY , 'targetEntity ' => UnknownDummy::class, 'joinColumns ' => [new JoinColumn ( nullable: false ) ]],
475476 ];
476477
477478 $ unknownClassMetadataProphecy = $ this ->prophesize (ClassMetadata::class);
@@ -577,7 +578,7 @@ public function testResourceClassNotFoundExceptionPropertyNameCollection(): void
577578
578579 $ classMetadataProphecy = $ this ->prophesize (ClassMetadata::class);
579580 $ classMetadataProphecy ->associationMappings = [
580- 'relation ' => ['fetch ' => ClassMetadata::FETCH_LAZY , 'targetEntity ' => UnknownDummy::class, 'joinColumns ' => [[ ' nullable ' => false ] ]],
581+ 'relation ' => ['fetch ' => ClassMetadata::FETCH_LAZY , 'targetEntity ' => UnknownDummy::class, 'joinColumns ' => [new JoinColumn ( nullable: false ) ]],
581582 ];
582583 $ emProphecy = $ this ->prophesize (EntityManager::class);
583584 $ emProphecy ->getClassMetadata (Dummy::class)->shouldBeCalled ()->willReturn ($ classMetadataProphecy ->reveal ());
@@ -751,8 +752,8 @@ public function testApplyToCollectionNoPartial(): void
751752
752753 $ classMetadataProphecy = $ this ->prophesize (ClassMetadata::class);
753754 $ classMetadataProphecy ->associationMappings = [
754- 'relatedDummy ' => ['fetch ' => ClassMetadata::FETCH_EAGER , 'joinColumns ' => [[ ' nullable ' => true ] ], 'targetEntity ' => RelatedDummy::class],
755- 'relatedDummy2 ' => ['fetch ' => ClassMetadata::FETCH_EAGER , 'joinColumns ' => [[ ' nullable ' => false ] ], 'targetEntity ' => RelatedDummy::class],
755+ 'relatedDummy ' => ['fetch ' => ClassMetadata::FETCH_EAGER , 'joinColumns ' => [new JoinColumn ( nullable: true ) ], 'targetEntity ' => RelatedDummy::class],
756+ 'relatedDummy2 ' => ['fetch ' => ClassMetadata::FETCH_EAGER , 'joinColumns ' => [new JoinColumn ( nullable: false ) ], 'targetEntity ' => RelatedDummy::class],
756757 ];
757758
758759 $ emProphecy = $ this ->prophesize (EntityManager::class);
@@ -796,8 +797,8 @@ public function testApplyToCollectionWithANonReadableButFetchEagerProperty(): vo
796797
797798 $ classMetadataProphecy = $ this ->prophesize (ClassMetadata::class);
798799 $ classMetadataProphecy ->associationMappings = [
799- 'relatedDummy ' => ['fetch ' => ClassMetadata::FETCH_EAGER , 'joinColumns ' => [[ ' nullable ' => true ] ], 'targetEntity ' => RelatedDummy::class],
800- 'relatedDummy2 ' => ['fetch ' => ClassMetadata::FETCH_EAGER , 'joinColumns ' => [[ ' nullable ' => false ] ], 'targetEntity ' => RelatedDummy::class],
800+ 'relatedDummy ' => ['fetch ' => ClassMetadata::FETCH_EAGER , 'joinColumns ' => [new JoinColumn ( nullable: true ) ], 'targetEntity ' => RelatedDummy::class],
801+ 'relatedDummy2 ' => ['fetch ' => ClassMetadata::FETCH_EAGER , 'joinColumns ' => [new JoinColumn ( nullable: false ) ], 'targetEntity ' => RelatedDummy::class],
801802 ];
802803
803804 $ emProphecy = $ this ->prophesize (EntityManager::class);
0 commit comments