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(
4747 $ args [] = $ array ;
4848 continue ;
4949 }
50+
51+ if ($ value ->isClassStringType ()->yes () && count ($ value ->getClassStringObjectType ()->getObjectClassNames ()) === 1 ) {
52+ $ args [] = $ value ->getClassStringObjectType ()->getObjectClassNames ()[0 ];
53+ continue ;
54+ }
55+
5056 if (count ($ value ->getConstantScalarValues ()) !== 1 ) {
5157 throw new DynamicQueryBuilderArgumentException ();
5258 }
Original file line number Diff line number Diff line change @@ -233,4 +233,33 @@ public function testDynamicMethodCall(
233233 assertType ('mixed ' , $ result );
234234 }
235235
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+
236265}
You can’t perform that action at this time.
0 commit comments