File tree 2 files changed +34
-0
lines changed
tests/Type/Doctrine/data/QueryResult
2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,12 @@ public function processArgs(
47
47
$ args [] = $ array ;
48
48
continue ;
49
49
}
50
+
51
+ if ($ value ->isClassStringType ()->yes () && count ($ value ->getClassStringObjectType ()->getObjectClassNames ()) === 1 ) {
52
+ $ args [] = $ value ->getClassStringObjectType ()->getObjectClassNames ()[0 ];
53
+ continue ;
54
+ }
55
+
50
56
if (count ($ value ->getConstantScalarValues ()) !== 1 ) {
51
57
throw new DynamicQueryBuilderArgumentException ();
52
58
}
Original file line number Diff line number Diff line change @@ -254,4 +254,32 @@ private function createVehicule(): VehicleInterface
254
254
return new Truck ();
255
255
}
256
256
257
+ /**
258
+ * @param class-string<Many> $many
259
+ */
260
+ public function testRegularClassString (EntityManagerInterface $ em , string $ many )
261
+ {
262
+ $ result = $ em ->createQueryBuilder ()
263
+ ->select ("m " )
264
+ ->from ($ many , 'm ' )
265
+ ->getQuery ()
266
+ ->getResult ();
267
+
268
+ assertType ('list<QueryResult\Entities\Many> ' , $ result );
269
+ }
270
+ /**
271
+ * @param class-string<T> $many
272
+ * @template T of Many
273
+ */
274
+ public function testTemplatedClassString (EntityManagerInterface $ em , string $ many )
275
+ {
276
+ $ result = $ em ->createQueryBuilder ()
277
+ ->select ("m " )
278
+ ->from ($ many , 'm ' )
279
+ ->getQuery ()
280
+ ->getResult ();
281
+
282
+ assertType ('list<QueryResult\Entities\Many> ' , $ result );
283
+ }
284
+
257
285
}
You can’t perform that action at this time.
0 commit comments