File tree Expand file tree Collapse file tree 2 files changed +34
-0
lines changed
tests/Type/Doctrine/data/QueryResult Expand file tree Collapse file tree 2 files changed +34
-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 @@ -254,4 +254,32 @@ private function createVehicule(): VehicleInterface
254254 return new Truck ();
255255 }
256256
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+
257285}
You can’t perform that action at this time.
0 commit comments