@@ -57,9 +57,10 @@ public function testApplyToCollection()
57
57
$ emProphecy ->getClassMetadata (RelatedDummy::class)->shouldBeCalled ()->willReturn ($ relatedClassMetadataProphecy ->reveal ());
58
58
59
59
$ queryBuilderProphecy = $ this ->prophesize (QueryBuilder::class);
60
- $ queryBuilderProphecy ->leftJoin ('o.relatedDummy ' , 'a0 ' )->shouldBeCalled (1 );
61
- $ queryBuilderProphecy ->innerJoin ('o.relatedDummy2 ' , 'a11 ' )->shouldBeCalled (1 );
62
- $ queryBuilderProphecy ->getEntityManager ()->shouldBeCalled (2 )->willReturn ($ emProphecy ->reveal ());
60
+ $ queryBuilderProphecy ->getRootAliases ()->willReturn (['o ' ]);
61
+ $ queryBuilderProphecy ->getEntityManager ()->willReturn ($ emProphecy );
62
+ $ queryBuilderProphecy ->leftJoin ('o.relatedDummy ' , 'relatedDummy_a1 ' )->shouldBeCalled (1 );
63
+ $ queryBuilderProphecy ->innerJoin ('o.relatedDummy2 ' , 'relatedDummy2_a2 ' )->shouldBeCalled (1 );
63
64
64
65
$ eagerExtensionTest = new EagerLoadingExtension ($ propertyMetadataFactoryProphecy ->reveal (), $ resourceMetadataFactoryProphecy ->reveal (), 30 , false );
65
66
$ eagerExtensionTest ->applyToCollection ($ queryBuilderProphecy ->reveal (), new QueryNameGenerator (), Dummy::class);
@@ -104,12 +105,13 @@ public function testApplyToItem()
104
105
$ emProphecy ->getClassMetadata (UnknownDummy::class)->shouldBeCalled ()->willReturn ($ unknownClassMetadataProphecy ->reveal ());
105
106
106
107
$ queryBuilderProphecy = $ this ->prophesize (QueryBuilder::class);
107
- $ queryBuilderProphecy ->leftJoin ('o.relatedDummy ' , 'a0 ' )->shouldBeCalled (1 );
108
- $ queryBuilderProphecy ->leftJoin ('a0.relation ' , 'a10 ' )->shouldBeCalled (1 );
109
- $ queryBuilderProphecy ->innerJoin ('o.relatedDummy2 ' , 'a111 ' )->shouldBeCalled (1 );
110
- $ queryBuilderProphecy ->innerJoin ('o.relatedDummy3 ' , 'a1122 ' )->shouldBeCalled (1 );
111
- $ queryBuilderProphecy ->leftJoin ('o.relatedDummy4 ' , 'a11233 ' )->shouldBeCalled (1 );
112
- $ queryBuilderProphecy ->getEntityManager ()->shouldBeCalled (2 )->willReturn ($ emProphecy ->reveal ());
108
+ $ queryBuilderProphecy ->getRootAliases ()->willReturn (['o ' ]);
109
+ $ queryBuilderProphecy ->getEntityManager ()->willReturn ($ emProphecy );
110
+ $ queryBuilderProphecy ->leftJoin ('o.relatedDummy ' , 'relatedDummy_a1 ' )->shouldBeCalled (1 );
111
+ $ queryBuilderProphecy ->leftJoin ('relatedDummy_a1.relation ' , 'relation_a2 ' )->shouldBeCalled (1 );
112
+ $ queryBuilderProphecy ->innerJoin ('o.relatedDummy2 ' , 'relatedDummy2_a3 ' )->shouldBeCalled (1 );
113
+ $ queryBuilderProphecy ->innerJoin ('o.relatedDummy3 ' , 'relatedDummy3_a4 ' )->shouldBeCalled (1 );
114
+ $ queryBuilderProphecy ->leftJoin ('o.relatedDummy4 ' , 'relatedDummy4_a5 ' )->shouldBeCalled (1 );
113
115
114
116
$ orderExtensionTest = new EagerLoadingExtension ($ propertyMetadataFactoryProphecy ->reveal (), $ resourceMetadataFactoryProphecy ->reveal (), 30 , false );
115
117
$ orderExtensionTest ->applyToItem ($ queryBuilderProphecy ->reveal (), new QueryNameGenerator (), Dummy::class, []);
@@ -132,7 +134,8 @@ public function testCreateItemWithOperationName()
132
134
$ emProphecy ->getClassMetadata (Dummy::class)->shouldBeCalled ()->willReturn ($ classMetadataProphecy ->reveal ());
133
135
134
136
$ queryBuilderProphecy = $ this ->prophesize (QueryBuilder::class);
135
- $ queryBuilderProphecy ->getEntityManager ()->shouldBeCalled ()->willReturn ($ emProphecy );
137
+ $ queryBuilderProphecy ->getRootAliases ()->willReturn (['o ' ]);
138
+ $ queryBuilderProphecy ->getEntityManager ()->willReturn ($ emProphecy );
136
139
137
140
$ orderExtensionTest = new EagerLoadingExtension ($ propertyMetadataFactoryProphecy ->reveal (), $ resourceMetadataFactoryProphecy ->reveal (), 30 , false );
138
141
$ orderExtensionTest ->applyToItem ($ queryBuilderProphecy ->reveal (), new QueryNameGenerator (), Dummy::class, [], 'item_operation ' );
@@ -155,7 +158,8 @@ public function testCreateCollectionWithOperationName()
155
158
$ emProphecy ->getClassMetadata (Dummy::class)->shouldBeCalled ()->willReturn ($ classMetadataProphecy ->reveal ());
156
159
157
160
$ queryBuilderProphecy = $ this ->prophesize (QueryBuilder::class);
158
- $ queryBuilderProphecy ->getEntityManager ()->shouldBeCalled ()->willReturn ($ emProphecy );
161
+ $ queryBuilderProphecy ->getRootAliases ()->willReturn (['o ' ]);
162
+ $ queryBuilderProphecy ->getEntityManager ()->willReturn ($ emProphecy );
159
163
160
164
$ eagerExtensionTest = new EagerLoadingExtension ($ propertyMetadataFactoryProphecy ->reveal (), $ resourceMetadataFactoryProphecy ->reveal (), 30 , false );
161
165
$ eagerExtensionTest ->applyToCollection ($ queryBuilderProphecy ->reveal (), new QueryNameGenerator (), Dummy::class, 'collection_operation ' );
@@ -177,7 +181,8 @@ public function testDenormalizeItemWithCorrectResourceClass()
177
181
$ emProphecy ->getClassMetadata (RelatedDummy::class)->shouldBeCalled ()->willReturn ($ classMetadataProphecy ->reveal ());
178
182
179
183
$ queryBuilderProphecy = $ this ->prophesize (QueryBuilder::class);
180
- $ queryBuilderProphecy ->getEntityManager ()->shouldBeCalled ()->willReturn ($ emProphecy );
184
+ $ queryBuilderProphecy ->getRootAliases ()->willReturn (['o ' ]);
185
+ $ queryBuilderProphecy ->getEntityManager ()->willReturn ($ emProphecy );
181
186
182
187
$ eagerExtensionTest = new EagerLoadingExtension ($ propertyMetadataFactoryProphecy ->reveal (), $ resourceMetadataFactoryProphecy ->reveal (), 30 , false );
183
188
$ eagerExtensionTest ->applyToItem ($ queryBuilderProphecy ->reveal (), new QueryNameGenerator (), RelatedDummy::class, ['id ' => 1 ], 'item_operation ' , ['resource_class ' => Dummy::class]);
@@ -199,7 +204,8 @@ public function testDenormalizeItemWithExistingGroups()
199
204
$ emProphecy ->getClassMetadata (RelatedDummy::class)->shouldBeCalled ()->willReturn ($ classMetadataProphecy ->reveal ());
200
205
201
206
$ queryBuilderProphecy = $ this ->prophesize (QueryBuilder::class);
202
- $ queryBuilderProphecy ->getEntityManager ()->shouldBeCalled ()->willReturn ($ emProphecy );
207
+ $ queryBuilderProphecy ->getRootAliases ()->willReturn (['o ' ]);
208
+ $ queryBuilderProphecy ->getEntityManager ()->willReturn ($ emProphecy );
203
209
204
210
$ eagerExtensionTest = new EagerLoadingExtension ($ propertyMetadataFactoryProphecy ->reveal (), $ resourceMetadataFactoryProphecy ->reveal (), 30 , false );
205
211
$ eagerExtensionTest ->applyToItem ($ queryBuilderProphecy ->reveal (), new QueryNameGenerator (), RelatedDummy::class, ['id ' => 1 ], 'item_operation ' , ['groups ' => 'some_groups ' ]);
@@ -239,7 +245,8 @@ public function testMaxDepthReached()
239
245
$ emProphecy ->getClassMetadata (RelatedDummy::class)->shouldBeCalled ()->willReturn ($ relatedClassMetadataProphecy ->reveal ());
240
246
241
247
$ queryBuilderProphecy = $ this ->prophesize (QueryBuilder::class);
242
- $ queryBuilderProphecy ->getEntityManager ()->willReturn ($ emProphecy ->reveal ());
248
+ $ queryBuilderProphecy ->getRootAliases ()->willReturn (['o ' ]);
249
+ $ queryBuilderProphecy ->getEntityManager ()->willReturn ($ emProphecy );
243
250
$ queryBuilderProphecy ->innerJoin (Argument::type ('string ' ), Argument::type ('string ' ))->shouldBeCalled ();
244
251
245
252
$ eagerExtensionTest = new EagerLoadingExtension ($ propertyMetadataFactoryProphecy ->reveal (), $ resourceMetadataFactoryProphecy ->reveal (), 30 , false );
@@ -270,8 +277,9 @@ public function testForceEager()
270
277
$ emProphecy ->getClassMetadata (UnknownDummy::class)->shouldBeCalled ()->willReturn ($ unknownClassMetadataProphecy ->reveal ());
271
278
272
279
$ queryBuilderProphecy = $ this ->prophesize (QueryBuilder::class);
273
- $ queryBuilderProphecy ->innerJoin ('o.relation ' , 'a0 ' )->shouldBeCalled (1 );
274
- $ queryBuilderProphecy ->getEntityManager ()->shouldBeCalled (2 )->willReturn ($ emProphecy ->reveal ());
280
+ $ queryBuilderProphecy ->getRootAliases ()->willReturn (['o ' ]);
281
+ $ queryBuilderProphecy ->getEntityManager ()->willReturn ($ emProphecy );
282
+ $ queryBuilderProphecy ->innerJoin ('o.relation ' , 'relation_a1 ' )->shouldBeCalled (1 );
275
283
276
284
$ orderExtensionTest = new EagerLoadingExtension ($ propertyMetadataFactoryProphecy ->reveal (), $ resourceMetadataFactoryProphecy ->reveal (), 30 , true );
277
285
$ orderExtensionTest ->applyToItem ($ queryBuilderProphecy ->reveal (), new QueryNameGenerator (), Dummy::class, []);
0 commit comments