File tree Expand file tree Collapse file tree 2 files changed +35
-0
lines changed
tests/Type/Doctrine/data/QueryResult Expand file tree Collapse file tree 2 files changed +35
-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 @@ -233,4 +233,33 @@ public function testDynamicMethodCall(
233
233
assertType ('mixed ' , $ result );
234
234
}
235
235
236
+
237
+ /**
238
+ * @param class-string<Many> $many
239
+ */
240
+ public function testRegularClassString (EntityManagerInterface $ em , string $ many )
241
+ {
242
+ $ result = $ em ->createQueryBuilder ()
243
+ ->select ("m " )
244
+ ->from ($ many , 'm ' )
245
+ ->getQuery ()
246
+ ->getResult ();
247
+
248
+ assertType ('list<QueryResult\Entities\Many> ' , $ result );
249
+ }
250
+ /**
251
+ * @param class-string<T> $many
252
+ * @template T of Many
253
+ */
254
+ public function testTemplatedClassString (EntityManagerInterface $ em , string $ many )
255
+ {
256
+ $ result = $ em ->createQueryBuilder ()
257
+ ->select ("m " )
258
+ ->from ($ many , 'm ' )
259
+ ->getQuery ()
260
+ ->getResult ();
261
+
262
+ assertType ('list<QueryResult\Entities\Many> ' , $ result );
263
+ }
264
+
236
265
}
You can’t perform that action at this time.
0 commit comments