Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2fe1c71

Browse files
bug #52606 [DoctrineBridge] Fix use "attribute" driver by default (vtsykun)
This PR was merged into the 7.0 branch. Discussion ---------- [DoctrineBridge] Fix use "attribute" driver by default | Q | A | ------------- | --- | Branch? | 7.0 | Bug fix? | yes | New feature? | - | Deprecations? | - | Issues | - | License | MIT When I tested 7.0-RC1 version I noticed an error of detect doctrine driver type by default ``` In AbstractDoctrineExtension.php line 219: [InvalidArgumentException] Mapping definitions for Doctrine manager "default" require at least the "type", "dir" and "prefix" options. Exception trace: at /var/www/packeton5/vendor/symfony/doctrine-bridge/DependencyInjection/AbstractDoctrineExtension.php:219 Symfony\Bridge\Doctrine\DependencyInjection\AbstractDoctrineExtension->assertValidMappingConfiguration() at /var/www/packeton5/vendor/symfony/doctrine-bridge/DependencyInjection/AbstractDoctrineExtension.php:97 Symfony\Bridge\Doctrine\DependencyInjection\AbstractDoctrineExtension->loadMappingInformation() at /var/www/packeton5/vendor/doctrine/doctrine-bundle/DependencyInjection/DoctrineExtension.php:837 Doctrine\Bundle\DoctrineBundle\DependencyInjection\DoctrineExtension->loadOrmEntityManagerMappingInformation() at /var/www/packeton5/vendor/doctrine/doctrine-bundle/DependencyInjection/DoctrineExtension.php:657 ``` my config ```yaml doctrine: orm: mappings: Packeton: is_bundle: false dir: '%kernel.project_dir%/src/Entity' prefix: 'Packeton\Entity' alias: Packeton ``` Bug was introduced here https://github.com/symfony/symfony/pull/52142/files#diff-0f981a325d8c9eea80a258c36237861d1d00b0fb62fb04f2488bf2165776c94eR94 This conditions is never executed, because `$mappingConfig['type']` is false by default ``` $mappingConfig['type'] ??= 'attribute'; ``` ![Tooltip_016](https://github.com/symfony/symfony/assets/21358010/93fd8cd8-4432-47e4-89e1-348a63f5eb9a) Commits ------- 44e9339 [DoctrineBridge] Fix use "attribute" driver by default
2 parents dc1eccc + 44e9339 commit 2fe1c71

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ protected function loadMappingInformation(array $objectManager, ContainerBuilder
9090
if (!$mappingConfig) {
9191
continue;
9292
}
93-
} else {
94-
$mappingConfig['type'] ??= 'attribute';
93+
} elseif (!$mappingConfig['type']) {
94+
$mappingConfig['type'] = 'attribute';
9595
}
9696

9797
$this->assertValidMappingConfiguration($mappingConfig, $objectManager['name']);

0 commit comments

Comments
 (0)