我刚刚升级到symfony 2.7,并且有令人讨厌的行为.
我的config.yml中的某些连接是可选项,并描述了不打算在每个prod实例中使用的外部数据库.
在执行缓存时:清除,现在似乎检查了每个连接,即使我不希望它们在特定服务器上处于活动状态.
设置--no-warmup选项时,问题发生的时间是一半
php app/console cache:clear --env=prod --no-warmup --verbose
[Doctrine\DBAL\Exception\ConnectionException]
驱动程序中发生异常:SQLSTATE [42000] [1049]未知数据库'bal_syncrho_database'异常跟踪:()at /var/www/ror3/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:103 Doctrine\DBAL\Driver\AbstractMySQLDriver-> convertException()at/var/www/ror3/vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php:133 Doctrine\DBAL\DBALException :: driverException()at/var/www/ror3/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver /PDOMySql/Driver.php:47 Doctrine\DBAL\Driver\PDOMySql\Driver-> connect()at /var/www/ror3/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:360 Doctrine\DBAL/connection-> connect()at /var/www/ror3/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:429 Doctrine\DBAL\Connection-> getDatabasePlatformVersion()at/var/www/ror3//var/www/ror3/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php :328 Doctrine\DBAL\Connection-> getDatabasePlatform()at/var/www/ror3/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFact ory.php:763 Doctrine\ORM\Mapping\ClassMetadataFactory-> getTargetPlatform()at /var/www/ror3/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:616 Doctrine\ORM\Mapping\ClassMetadataFactory-> completeIdGeneratorMapping()位于/ var/www的/var/www/ror3/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:174 Doctrine\ORM\Mapping\ClassMetadataFactory-> doLoadMetadata() /ror3/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php:332 Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory-> loadMetadata()at/var/www/ror3/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:78 Doctrine\ORM\Mapping\ClassMetadataFactory-> loadMetadata()at/var/www/ror3/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping /AbstractClassMetadataFactory.php:216在Doc var/www/www/ror3/vendor/doctrine/common/lib/Doctrine/Common stence/Mapping/AbstractClassMetadataFactory.php:115 Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory-> getAllMetadata()at /var/www/ror3/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/CacheWarmer/ProxyCacheWarmer.php :69/Symfony\Bridge\Doctrine\CacheWarmer\ProxyCacheWarmer-> warmUp()at /var/www/ror3/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmerAggregate.php:48 Symfony\Component\HttpKernel\cacheWarmer\CacheWarmerAggregate-> warmUp()at /var/www/ror3/app/bootstrap.php.cache:2641 Symfony\Component\HttpKernel\Kernel-> initializeContainer()at/var/www/ror3/app/bootstrap. php.cache:2411 Symfony\Component\HttpKernel\Kernel-> boot()at /var/www/ror3/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:70 Symfony\Bundle\FrameworkBundle\Console\Application-> doRun()at /var/www/ror3/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:120 Symfony\Component\Console\Application-> run()at
在/ var/WWW/ror3 /应用/ 控制台:27
Matteo.. 76
Doctrine正试图确定数据库平台版本.
您可以避免在Doctrine DBAL Configuration中添加服务器版本的此行为.来自doc:
在DoctrineBundle 1.3中使用的Doctrine DBAL 2.5中添加了server_version选项.此选项的值应与您的数据库服务器版本匹配(使用postgres -V或psql -V命令查找PostgreSQL版本,使用mysql -V获取MySQL版本).
如果您没有定义此选项但尚未创建数据库,则可能会出现PDOException错误,因为Doctrine会尝试自动猜测数据库服务器版本,但没有可用的版本.
例如:
#config.yml doctrine: dbal: ... server_version: 5.6
希望这有帮助
Doctrine正试图确定数据库平台版本.
您可以避免在Doctrine DBAL Configuration中添加服务器版本的此行为.来自doc:
在DoctrineBundle 1.3中使用的Doctrine DBAL 2.5中添加了server_version选项.此选项的值应与您的数据库服务器版本匹配(使用postgres -V或psql -V命令查找PostgreSQL版本,使用mysql -V获取MySQL版本).
如果您没有定义此选项但尚未创建数据库,则可能会出现PDOException错误,因为Doctrine会尝试自动猜测数据库服务器版本,但没有可用的版本.
例如:
#config.yml doctrine: dbal: ... server_version: 5.6
希望这有帮助