Skip to content
Merged
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
2 changes: 0 additions & 2 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ parameters:
PHPUnit\Framework\Constraint\Constraint:
- fail
ignoreErrors:
# Real problems, hard to fix
- '#Parameter \#2 \$dqlPart of method Doctrine\\ORM\\QueryBuilder::add\(\) expects array\|object, string given\.#'
# False positives
-
message: '#Strict comparison using !== between .+ and .+ will always evaluate to false\.#'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ private function getQueryBuilderWithNewAliases(QueryBuilder $queryBuilder, Query
$replacements[] = "$newAlias.";
$condition = str_replace($aliases, $replacements, $joinPart->getCondition());
$join = new Join($joinPart->getJoinType(), $joinPart->getJoin(), $newAlias, $joinPart->getConditionType(), $condition);
/* @phpstan-ignore-next-line */
$queryBuilderClone->add('join', [$replacement => $join], true);
}

Expand Down
1 change: 1 addition & 0 deletions src/Bridge/Doctrine/Orm/Util/QueryBuilderHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ public static function getExistingJoin(QueryBuilder $queryBuilder, string $alias
*/
private static function mapRootAliases(array $rootAliases, array $rootEntities): array
{
/** @var false|array $aliasMap */
$aliasMap = array_combine($rootAliases, $rootEntities);
if (false === $aliasMap) {
throw new \LogicException('Number of root aliases and root entities do not match.');
Expand Down
9 changes: 5 additions & 4 deletions tests/Behat/DoctrineContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ final class DoctrineContext implements Context
private $passwordEncoder;
private $schemaTool;
private $schemaManager;
private $classes;

/**
* Initializes context.
Expand All @@ -198,17 +197,19 @@ public function __construct(ManagerRegistry $doctrine, UserPasswordEncoderInterf
$this->manager = $doctrine->getManager();
$this->schemaTool = $this->manager instanceof EntityManagerInterface ? new SchemaTool($this->manager) : null;
$this->schemaManager = $this->manager instanceof DocumentManager ? $this->manager->getSchemaManager() : null;
$this->classes = $this->manager->getMetadataFactory()->getAllMetadata();
}

/**
* @BeforeScenario @createSchema
*/
public function createDatabase()
{
/** @var \Doctrine\ORM\Mapping\ClassMetadata[] $classes */
$classes = $this->manager->getMetadataFactory()->getAllMetadata();

if ($this->isOrm()) {
$this->schemaTool->dropSchema($this->classes);
$this->schemaTool->createSchema($this->classes);
$this->schemaTool->dropSchema($classes);
$this->schemaTool->createSchema($classes);
}

if ($this->isOdm()) {
Expand Down
1 change: 1 addition & 0 deletions tests/Bridge/Symfony/Bundle/Test/ApiTestCaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ public function testFindIriBy(): void
* @var EntityManagerInterface
*/
$manager = self::$container->get('doctrine')->getManager();
/** @var \Doctrine\ORM\Mapping\ClassMetadata[] $classes */
$classes = $manager->getMetadataFactory()->getAllMetadata();
$schemaTool = new SchemaTool($manager);

Expand Down
1 change: 1 addition & 0 deletions tests/Bridge/Symfony/Bundle/Test/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ protected function setUp(): void
* @var EntityManagerInterface
*/
$manager = self::$container->get('doctrine')->getManager();
/** @var \Doctrine\ORM\Mapping\ClassMetadata[] $classes */
$classes = $manager->getMetadataFactory()->getAllMetadata();
$schemaTool = new SchemaTool($manager);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ protected function setUp(): void
$manager = $doctrine->getManager();
$this->manager = $manager;
$this->schemaTool = new SchemaTool($this->manager);
/** @var \Doctrine\ORM\Mapping\ClassMetadata[] $classes */
$classes = $this->manager->getMetadataFactory()->getAllMetadata();
$this->schemaTool->dropSchema($classes);
$this->manager->clear();
Expand Down