Skip to content

Commit

Permalink
Look for QueryBuilder in nested methods when calling getQuery() direc…
Browse files Browse the repository at this point in the history
…tly on QueryBuilder
  • Loading branch information
ondrejmirtes committed Feb 8, 2022
1 parent 7460f9d commit 149cf71
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/Type/Doctrine/data/QueryResult/queryBuilderGetQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,24 @@

class QueryBuilderGetQuery
{
private function getQueryBuilderMany(EntityManagerInterface $em): QueryBuilder
{
return $em->createQueryBuilder()
->select('m')
->from(Many::class, 'm');
}

public function addAndWhereAndGetQuery(EntityManagerInterface $em): void
{
$qb = $this->getQueryBuilderMany($em)->andWhere('m.intColumn = 1');
assertType('array<QueryResult\Entities\Many>', $qb->getQuery()->getResult());
}

public function getQueryDirectly(EntityManagerInterface $em): void
{
assertType('array<QueryResult\Entities\Many>', $this->getQueryBuilderMany($em)->getQuery()->getResult());
}

public function testQueryTypeParametersAreInfered(EntityManagerInterface $em): void
{
$query = $em->createQueryBuilder()
Expand Down

0 comments on commit 149cf71

Please sign in to comment.