Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failing test: diving to traits does not work #627

Open
wants to merge 1 commit into
base: 2.0.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions tests/Type/Doctrine/data/QueryResult/queryBuilderGetQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@

class QueryBuilderGetQuery
{

use TraitWithQueryBuilder;

private function getQueryBuilderMany(EntityManagerInterface $em): QueryBuilder
{
return $em->createQueryBuilder()
Expand All @@ -33,6 +36,11 @@ public function getQueryDirectly(EntityManagerInterface $em): void
assertType('list<QueryResult\Entities\Many>', $this->getQueryBuilderMany($em)->getQuery()->getResult());
}

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

public function testQueryTypeParametersAreInfered(EntityManagerInterface $em): void
{
$query = $em->createQueryBuilder()
Expand Down
18 changes: 18 additions & 0 deletions tests/Type/Doctrine/data/QueryResult/traitWithQueryBuilder.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php declare(strict_types = 1);

namespace QueryResult\CreateQuery;

use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\QueryBuilder;
use QueryResult\Entities\Many;

trait TraitWithQueryBuilder
{
public function getQueryBuilderFromTrait(EntityManagerInterface $em): QueryBuilder
{
return $em->createQueryBuilder()
->select('m')
->from(Many::class, 'm');
}

}
Loading