29
29
use ApiPlatform \Tests \Fixtures \TestBundle \Entity \Dummy ;
30
30
use ApiPlatform \Tests \Fixtures \TestBundle \Entity \EmbeddableDummy ;
31
31
use ApiPlatform \Tests \Fixtures \TestBundle \Entity \RelatedDummy ;
32
- use ApiPlatform \Tests \Fixtures \TestBundle \Entity \ThirdLevel ;
33
32
use ApiPlatform \Tests \Fixtures \TestBundle \Entity \UnknownDummy ;
34
33
use Doctrine \ORM \EntityManager ;
35
34
use Doctrine \ORM \Mapping \ClassMetadata ;
@@ -141,7 +140,6 @@ public function testApplyToItem(): void
141
140
$ propertyNameCollectionFactoryProphecy ->create (RelatedDummy::class)->willReturn ($ relatedNameCollection )->shouldBeCalled ();
142
141
$ propertyNameCollectionFactoryProphecy ->create (EmbeddableDummy::class)->willReturn ($ relatedEmbedableCollection )->shouldBeCalled ();
143
142
$ propertyNameCollectionFactoryProphecy ->create (UnknownDummy::class)->willReturn (new PropertyNameCollection (['id ' ]))->shouldBeCalled ();
144
- $ propertyNameCollectionFactoryProphecy ->create (ThirdLevel::class)->willReturn (new PropertyNameCollection (['id ' ]))->shouldBeCalled ();
145
143
146
144
$ propertyMetadataFactoryProphecy = $ this ->prophesize (PropertyMetadataFactoryInterface::class);
147
145
$ relationPropertyMetadata = new ApiProperty ();
@@ -153,7 +151,6 @@ public function testApplyToItem(): void
153
151
$ propertyMetadataFactoryProphecy ->create (Dummy::class, 'relatedDummy4 ' , $ callContext )->willReturn ($ relationPropertyMetadata )->shouldBeCalled ();
154
152
$ propertyMetadataFactoryProphecy ->create (Dummy::class, 'relatedDummy5 ' , $ callContext )->willReturn ($ relationPropertyMetadata )->shouldBeCalled ();
155
153
$ propertyMetadataFactoryProphecy ->create (Dummy::class, 'singleInheritanceRelation ' , $ callContext )->willReturn ($ relationPropertyMetadata )->shouldBeCalled ();
156
- $ propertyMetadataFactoryProphecy ->create (Dummy::class, 'relatedDummies ' , $ callContext )->willReturn ($ relationPropertyMetadata )->shouldBeCalled ();
157
154
158
155
$ idPropertyMetadata = new ApiProperty ();
159
156
$ idPropertyMetadata = $ idPropertyMetadata ->withIdentifier (true );
@@ -172,9 +169,7 @@ public function testApplyToItem(): void
172
169
$ propertyMetadataFactoryProphecy ->create (RelatedDummy::class, 'notindatabase ' , $ callContext )->willReturn ($ notInDatabasePropertyMetadata )->shouldBeCalled ();
173
170
$ propertyMetadataFactoryProphecy ->create (RelatedDummy::class, 'notreadable ' , $ callContext )->willReturn ($ notReadablePropertyMetadata )->shouldBeCalled ();
174
171
$ propertyMetadataFactoryProphecy ->create (RelatedDummy::class, 'relation ' , $ callContext )->willReturn ($ relationPropertyMetadata )->shouldBeCalled ();
175
- $ propertyMetadataFactoryProphecy ->create (RelatedDummy::class, 'thirdLevel ' , $ callContext )->willReturn ($ relationPropertyMetadata )->shouldBeCalled ();
176
172
$ propertyMetadataFactoryProphecy ->create (UnknownDummy::class, 'id ' , $ callContext )->willReturn ($ idPropertyMetadata )->shouldBeCalled ();
177
- $ propertyMetadataFactoryProphecy ->create (ThirdLevel::class, 'id ' , $ callContext )->willReturn ($ idPropertyMetadata )->shouldBeCalled ();
178
173
179
174
$ queryBuilderProphecy = $ this ->prophesize (QueryBuilder::class);
180
175
@@ -186,7 +181,6 @@ public function testApplyToItem(): void
186
181
'relatedDummy4 ' => ['fetch ' => ClassMetadataInfo::FETCH_EAGER , 'targetEntity ' => UnknownDummy::class],
187
182
'relatedDummy5 ' => ['fetch ' => ClassMetadataInfo::FETCH_LAZY , 'targetEntity ' => UnknownDummy::class],
188
183
'singleInheritanceRelation ' => ['fetch ' => ClassMetadataInfo::FETCH_EAGER , 'targetEntity ' => AbstractDummy::class],
189
- 'relatedDummies ' => ['fetch ' => ClassMetadataInfo::FETCH_EAGER , 'targetEntity ' => RelatedDummy::class],
190
184
];
191
185
192
186
$ relatedClassMetadataProphecy = $ this ->prophesize (ClassMetadata::class);
@@ -200,7 +194,6 @@ public function testApplyToItem(): void
200
194
201
195
$ relatedClassMetadataProphecy ->associationMappings = [
202
196
'relation ' => ['fetch ' => ClassMetadataInfo::FETCH_EAGER , 'joinColumns ' => [['nullable ' => false ]], 'targetEntity ' => UnknownDummy::class],
203
- 'thirdLevel ' => ['fetch ' => ClassMetadataInfo::FETCH_EAGER , 'targetEntity ' => ThirdLevel::class, 'sourceEntity ' => RelatedDummy::class, 'inversedBy ' => 'relatedDummies ' , 'type ' => ClassMetadata::TO_ONE ],
204
197
];
205
198
206
199
$ relatedClassMetadataProphecy ->embeddedClasses = ['embeddedDummy ' => ['class ' => EmbeddableDummy::class]];
@@ -211,38 +204,26 @@ public function testApplyToItem(): void
211
204
$ unknownClassMetadataProphecy = $ this ->prophesize (ClassMetadata::class);
212
205
$ unknownClassMetadataProphecy ->associationMappings = [];
213
206
214
- $ thirdLevelMetadataProphecy = $ this ->prophesize (ClassMetadata::class);
215
- $ thirdLevelMetadataProphecy ->associationMappings = [];
216
-
217
207
$ emProphecy = $ this ->prophesize (EntityManager::class);
218
208
$ emProphecy ->getClassMetadata (Dummy::class)->shouldBeCalled ()->willReturn ($ classMetadataProphecy ->reveal ());
219
209
$ emProphecy ->getClassMetadata (RelatedDummy::class)->shouldBeCalled ()->willReturn ($ relatedClassMetadataProphecy ->reveal ());
220
210
$ emProphecy ->getClassMetadata (AbstractDummy::class)->shouldBeCalled ()->willReturn ($ singleInheritanceClassMetadataProphecy ->reveal ());
221
211
$ emProphecy ->getClassMetadata (UnknownDummy::class)->shouldBeCalled ()->willReturn ($ unknownClassMetadataProphecy ->reveal ());
222
- $ emProphecy ->getClassMetadata (ThirdLevel::class)->shouldBeCalled ()->willReturn ($ thirdLevelMetadataProphecy ->reveal ());
223
212
224
213
$ queryBuilderProphecy ->getRootAliases ()->willReturn (['o ' ]);
225
214
$ queryBuilderProphecy ->getEntityManager ()->willReturn ($ emProphecy );
226
215
$ queryBuilderProphecy ->leftJoin ('o.relatedDummy ' , 'relatedDummy_a1 ' )->shouldBeCalledTimes (1 );
227
216
$ queryBuilderProphecy ->leftJoin ('relatedDummy_a1.relation ' , 'relation_a2 ' )->shouldBeCalledTimes (1 );
228
- $ queryBuilderProphecy ->leftJoin ('relatedDummy_a1.thirdLevel ' , 'thirdLevel_a3 ' )->shouldBeCalledTimes (1 );
229
- $ queryBuilderProphecy ->innerJoin ('o.relatedDummy2 ' , 'relatedDummy2_a4 ' )->shouldBeCalledTimes (1 );
230
- $ queryBuilderProphecy ->leftJoin ('o.relatedDummy3 ' , 'relatedDummy3_a5 ' )->shouldBeCalledTimes (1 );
231
- $ queryBuilderProphecy ->leftJoin ('o.relatedDummy4 ' , 'relatedDummy4_a6 ' )->shouldBeCalledTimes (1 );
232
- $ queryBuilderProphecy ->leftJoin ('o.singleInheritanceRelation ' , 'singleInheritanceRelation_a7 ' )->shouldBeCalledTimes (1 );
233
- $ queryBuilderProphecy ->leftJoin ('o.relatedDummies ' , 'relatedDummies_a8 ' )->shouldBeCalledTimes (1 );
234
- $ queryBuilderProphecy ->leftJoin ('relatedDummies_a8.relation ' , 'relation_a9 ' )->shouldBeCalledTimes (1 );
235
- $ queryBuilderProphecy ->leftJoin ('relatedDummies_a8.thirdLevel ' , 'thirdLevel_a10 ' )->shouldBeCalledTimes (1 );
217
+ $ queryBuilderProphecy ->innerJoin ('o.relatedDummy2 ' , 'relatedDummy2_a3 ' )->shouldBeCalledTimes (1 );
218
+ $ queryBuilderProphecy ->leftJoin ('o.relatedDummy3 ' , 'relatedDummy3_a4 ' )->shouldBeCalledTimes (1 );
219
+ $ queryBuilderProphecy ->leftJoin ('o.relatedDummy4 ' , 'relatedDummy4_a5 ' )->shouldBeCalledTimes (1 );
220
+ $ queryBuilderProphecy ->leftJoin ('o.singleInheritanceRelation ' , 'singleInheritanceRelation_a6 ' )->shouldBeCalledTimes (1 );
236
221
$ queryBuilderProphecy ->addSelect ('partial relatedDummy_a1.{id,name,embeddedDummy.name} ' )->shouldBeCalledTimes (1 );
237
- $ queryBuilderProphecy ->addSelect ('partial thirdLevel_a3.{id} ' )->shouldBeCalledTimes (1 );
238
222
$ queryBuilderProphecy ->addSelect ('partial relation_a2.{id} ' )->shouldBeCalledTimes (1 );
239
- $ queryBuilderProphecy ->addSelect ('partial relatedDummy2_a4.{id} ' )->shouldBeCalledTimes (1 );
240
- $ queryBuilderProphecy ->addSelect ('partial relatedDummy3_a5.{id} ' )->shouldBeCalledTimes (1 );
241
- $ queryBuilderProphecy ->addSelect ('partial relatedDummy4_a6.{id} ' )->shouldBeCalledTimes (1 );
242
- $ queryBuilderProphecy ->addSelect ('singleInheritanceRelation_a7 ' )->shouldBeCalledTimes (1 );
243
- $ queryBuilderProphecy ->addSelect ('partial relatedDummies_a8.{id,name,embeddedDummy.name} ' )->shouldBeCalledTimes (1 );
244
- $ queryBuilderProphecy ->addSelect ('partial relation_a9.{id} ' )->shouldBeCalledTimes (1 );
245
- $ queryBuilderProphecy ->addSelect ('partial thirdLevel_a10.{id} ' )->shouldBeCalledTimes (1 );
223
+ $ queryBuilderProphecy ->addSelect ('partial relatedDummy2_a3.{id} ' )->shouldBeCalledTimes (1 );
224
+ $ queryBuilderProphecy ->addSelect ('partial relatedDummy3_a4.{id} ' )->shouldBeCalledTimes (1 );
225
+ $ queryBuilderProphecy ->addSelect ('partial relatedDummy4_a5.{id} ' )->shouldBeCalledTimes (1 );
226
+ $ queryBuilderProphecy ->addSelect ('singleInheritanceRelation_a6 ' )->shouldBeCalledTimes (1 );
246
227
$ queryBuilderProphecy ->getDQLPart ('join ' )->willReturn ([]);
247
228
$ queryBuilderProphecy ->getDQLPart ('select ' )->willReturn ([]);
248
229
0 commit comments