Skip to content

Commit

Permalink
Make configuration error message better understandable (#1367)
Browse files Browse the repository at this point in the history
  • Loading branch information
icanhazstring authored Jun 2, 2021
1 parent aa17a6c commit 3242af8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ private function addDbalSection(ArrayNodeDefinition $node): void
}

if ($connection && $hasExplicitlyDefinedConnectionsAtLeastOnce) {
throw new InvalidArgumentException('Either explicitly define DBAL connections in all doctrine-bundle configuration files, or in none of them');
throw new InvalidArgumentException('Seems like you have configured multiple "dbal" connections. You need to use the long configuration syntax in every doctrine configuration file, or in none of them.');
}

$v['default_connection'] = isset($v['default_connection']) ? (string) $v['default_connection'] : 'default';
Expand Down Expand Up @@ -413,7 +413,7 @@ private function addOrmSection(ArrayNodeDefinition $node): void
}

if ($entityManager && $hasExplicitlyDefinedEntityManagersAtLeastOnce) {
throw new InvalidArgumentException('Either explicitly define entity managers in all doctrine-bundle configuration files, or in none of them');
throw new InvalidArgumentException('Seems like you have configured multiple "entity_managers". You need to use the long configuration syntax in every doctrine configuration file, or in none of them.');
}

$v['default_entity_manager'] = isset($v['default_entity_manager']) ? (string) $v['default_entity_manager'] : 'default';
Expand Down
4 changes: 2 additions & 2 deletions Tests/DependencyInjection/AbstractDoctrineExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,13 +218,13 @@ class_exists(PrimaryReadReplicaConnection::class) ?

public function testMixedUseOfSimplifiedAndMultipleConnectionsStyleIsInvalid(): void
{
$this->expectExceptionObject(new InvalidArgumentException('Either explicitly define DBAL connections in all doctrine-bundle configuration files, or in none of them'));
$this->expectExceptionObject(new InvalidArgumentException('Seems like you have configured multiple "dbal" connections. You need to use the long configuration syntax in every doctrine configuration file, or in none of them.'));
$this->loadContainer('dbal_service_{single,multiple}_connectio{n,ns}');
}

public function testMixedUseOfSimplifiedAndMultipleEntityManagersStyleIsInvalid(): void
{
$this->expectExceptionObject(new InvalidArgumentException('Either explicitly define entity managers in all doctrine-bundle configuration files, or in none of them'));
$this->expectExceptionObject(new InvalidArgumentException('Seems like you have configured multiple "entity_managers". You need to use the long configuration syntax in every doctrine configuration file, or in none of them.'));
$this->loadContainer('orm_service_{simple_single,multiple}_entity_manage{r,rs}');
}

Expand Down

0 comments on commit 3242af8

Please sign in to comment.