[Bug]: Not configuring a schema manager factory is deprecated. Use %s which is going to be the default in DBAL 4.
Preconditions
protected function createDatabaseIfNotExists(): void
{
$params = $this->connection->getParams();
// doctrine-bundle >= 2.2
if (isset($params['primary'])) {
$params = $params['primary'];
}
// doctrine-bundle < 2.2
elseif (isset($params['master'])) {
$params = $params['master'];
}
$dbName = $params['dbname'] ?? '';
unset($params['dbname'], $params['url']);
// Unset url to avoid issue:
// “An exception occurred in driver: SQLSTATE[HY000] [1049] Unknown database 'test'”
$tmpConnection = DriverManager::getConnection($params, <- here needed to inject configuration with defined schema manager);
Steps to reproduce
Just start use library
Expected result
No deprecations
Actual result
Has deprecations
Thanks for the report, what is %s in this context? Do you have more information about this deprecation?
I have the same issue and in my case %s is Doctrine\DBAL\Schema\DefaultSchemaManagerFactory.
Full notice:
Not configuring a schema manager factory is deprecated. Use Doctrine\DBAL\Schema\DefaultSchemaManagerFactory which is going to be the default in DBAL 4. (Connection.php:222 called by DriverManager.php:197, https://github.com/doctrine/dbal/issues/5812, package doctrine/dbal)
Thanks for the deprecation message.
It comes from these lines: https://github.com/doctrine/dbal/blob/0ac3d64b6159eb2abccb7945c7969c76da30f5bb/src/Connection.php#L225-L236
The call is initiated by: https://github.com/liip/LiipTestFixturesBundle/blob/91ef15e1e4bf96c2a3b9d4374c6410bd08d5b471/src/Services/DatabaseTools/ORMDatabaseTool.php#L174
The deprecation message contains this link:
- https://github.com/doctrine/dbal/issues/5812
That was closed by:
- https://github.com/doctrine/dbal/pull/5876
I don't understand what are the required changes.
But I have no issue when loading fixtures in a project that use doctrine/dbal 4.2.1, so it looks like it works with DBAL 4.x.
Please try the last release: https://github.com/liip/LiipTestFixturesBundle/releases/tag/3.2.1