35
35
use ApiPlatform \Metadata \Property \PropertyNameCollection ;
36
36
use Doctrine \ORM \EntityManager ;
37
37
use Doctrine \ORM \Mapping \ClassMetadata ;
38
+ use Doctrine \ORM \Mapping \JoinColumn ;
38
39
use Doctrine \ORM \Query \Expr \Join ;
39
40
use Doctrine \ORM \QueryBuilder ;
40
41
use PHPUnit \Framework \TestCase ;
@@ -94,8 +95,8 @@ public function testApplyToCollection(): void
94
95
95
96
$ classMetadataProphecy = $ this ->prophesize (ClassMetadata::class);
96
97
$ 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],
99
100
];
100
101
101
102
$ relatedClassMetadataProphecy = $ this ->prophesize (ClassMetadata::class);
@@ -181,9 +182,9 @@ public function testApplyToItem(): void
181
182
182
183
$ classMetadataProphecy = $ this ->prophesize (ClassMetadata::class);
183
184
$ 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],
187
188
'relatedDummy4 ' => ['fetch ' => ClassMetadata::FETCH_EAGER , 'targetEntity ' => UnknownDummy::class],
188
189
'relatedDummy5 ' => ['fetch ' => ClassMetadata::FETCH_LAZY , 'targetEntity ' => UnknownDummy::class],
189
190
'singleInheritanceRelation ' => ['fetch ' => ClassMetadata::FETCH_EAGER , 'targetEntity ' => AbstractDummy::class],
@@ -200,7 +201,7 @@ public function testApplyToItem(): void
200
201
$ relatedClassMetadataProphecy ->hasField ('embeddedDummy.name ' )->willReturn (true )->shouldBeCalled ();
201
202
202
203
$ 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],
204
205
'thirdLevel ' => ['fetch ' => ClassMetadata::FETCH_EAGER , 'targetEntity ' => ThirdLevel::class, 'sourceEntity ' => RelatedDummy::class, 'inversedBy ' => 'relatedDummies ' , 'type ' => ClassMetadata::TO_ONE ],
205
206
];
206
207
@@ -361,13 +362,13 @@ public function testMaxJoinsReached(): void
361
362
362
363
$ classMetadataProphecy = $ this ->prophesize (ClassMetadata::class);
363
364
$ 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],
365
366
];
366
367
$ classMetadataProphecy ->hasField ('relatedDummy ' )->willReturn (true );
367
368
368
369
$ relatedClassMetadataProphecy = $ this ->prophesize (ClassMetadata::class);
369
370
$ 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],
371
372
];
372
373
$ relatedClassMetadataProphecy ->hasField ('dummy ' )->willReturn (true );
373
374
@@ -410,13 +411,13 @@ public function testMaxDepth(): void
410
411
411
412
$ classMetadataProphecy = $ this ->prophesize (ClassMetadata::class);
412
413
$ 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],
414
415
];
415
416
$ classMetadataProphecy ->hasField ('relatedDummy ' )->willReturn (true );
416
417
417
418
$ relatedClassMetadataProphecy = $ this ->prophesize (ClassMetadata::class);
418
419
$ 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],
420
421
];
421
422
$ relatedClassMetadataProphecy ->hasField ('dummy ' )->willReturn (true );
422
423
@@ -471,7 +472,7 @@ public function testForceEager(): void
471
472
472
473
$ classMetadataProphecy = $ this ->prophesize (ClassMetadata::class);
473
474
$ 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 ) ]],
475
476
];
476
477
477
478
$ unknownClassMetadataProphecy = $ this ->prophesize (ClassMetadata::class);
@@ -577,7 +578,7 @@ public function testResourceClassNotFoundExceptionPropertyNameCollection(): void
577
578
578
579
$ classMetadataProphecy = $ this ->prophesize (ClassMetadata::class);
579
580
$ 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 ) ]],
581
582
];
582
583
$ emProphecy = $ this ->prophesize (EntityManager::class);
583
584
$ emProphecy ->getClassMetadata (Dummy::class)->shouldBeCalled ()->willReturn ($ classMetadataProphecy ->reveal ());
@@ -751,8 +752,8 @@ public function testApplyToCollectionNoPartial(): void
751
752
752
753
$ classMetadataProphecy = $ this ->prophesize (ClassMetadata::class);
753
754
$ 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],
756
757
];
757
758
758
759
$ emProphecy = $ this ->prophesize (EntityManager::class);
@@ -796,8 +797,8 @@ public function testApplyToCollectionWithANonReadableButFetchEagerProperty(): vo
796
797
797
798
$ classMetadataProphecy = $ this ->prophesize (ClassMetadata::class);
798
799
$ 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],
801
802
];
802
803
803
804
$ emProphecy = $ this ->prophesize (EntityManager::class);
0 commit comments