bug #29399 [FrameworkBundle] define doctrine as default_pdo_provider only if the package is installed (nicolas-grekas)

This PR was merged into the 4.2 branch.

Discussion
----------

[FrameworkBundle] define doctrine as default_pdo_provider only if the package is installed

| Q             | A
| ------------- | ---
| Branch?       | 4.2
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #29384
| License       | MIT
| Doc PR        | -

Commits
-------

cf7501299d [FrameworkBundle] define doctrine as default_pdo_provider only if the package is installed
This commit is contained in:
Nicolas Grekas 2018-12-01 09:44:35 +01:00
commit e9c4a8c570
2 changed files with 4 additions and 2 deletions

View File

@ -13,6 +13,7 @@ namespace Symfony\Bundle\FrameworkBundle\DependencyInjection;
use Doctrine\Common\Annotations\Annotation;
use Doctrine\Common\Cache\Cache;
use Doctrine\DBAL\Connection;
use Symfony\Bundle\FullStack;
use Symfony\Component\Asset\Package;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
@ -882,7 +883,7 @@ class Configuration implements ConfigurationInterface
->scalarNode('default_psr6_provider')->end()
->scalarNode('default_redis_provider')->defaultValue('redis://localhost')->end()
->scalarNode('default_memcached_provider')->defaultValue('memcached://localhost')->end()
->scalarNode('default_pdo_provider')->defaultValue('doctrine.dbal.default_connection')->end()
->scalarNode('default_pdo_provider')->defaultValue(class_exists(Connection::class) ? 'database_connection' : null)->end()
->arrayNode('pools')
->useAttributeAsKey('name')
->prototype('array')

View File

@ -11,6 +11,7 @@
namespace Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection;
use Doctrine\DBAL\Connection;
use PHPUnit\Framework\TestCase;
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Configuration;
use Symfony\Bundle\FullStack;
@ -268,7 +269,7 @@ class ConfigurationTest extends TestCase
'directory' => '%kernel.cache_dir%/pools',
'default_redis_provider' => 'redis://localhost',
'default_memcached_provider' => 'memcached://localhost',
'default_pdo_provider' => 'doctrine.dbal.default_connection',
'default_pdo_provider' => class_exists(Connection::class) ? 'database_connection' : null,
),
'workflows' => array(
'enabled' => false,