Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect assert on AbstractSQLServerDriver connection #5583

Closed
elavrom opened this issue Aug 10, 2022 · 1 comment · Fixed by #5585
Closed

Incorrect assert on AbstractSQLServerDriver connection #5583

elavrom opened this issue Aug 10, 2022 · 1 comment · Fixed by #5585

Comments

@elavrom
Copy link

elavrom commented Aug 10, 2022

Bug Report

Q A
Version 3.4.0

Summary

On SQL Server platform, having a custom doctrine.dbal.connections[].platform_service that extends SQLServerPlatform, the call for AbstractSQLServerDriver::getSchemaManager() breaks due to an incorrect assert.

Current behaviour

The assertion in getSchemaManager() fails because it is as follows :

# \Doctrine\DBAL\Driver\AbstractSQLServerDriver: line 43
assert($platform instanceof SQLServer2012Platform);

My custom platform is extending SQLServerPlatform to prevent the deprecation, so this assertion fails

How to reproduce

# src/Doctrine/DBAL/Platforms/SQLServerPlatform.php
namespace App\Doctrine\DBAL\Platforms;

use Doctrine\DBAL\Platforms\SQLServerPlatform as DoctrineSQLServerPlatformAlias;

class SQLServerPlatform extends DoctrineSQLServerPlatformAlias
{
}
# config/packages/doctrine.yaml
# ...
doctrine:
  dbal:
    platform_service: 'App\Doctrine\DBAL\Platforms\SQLServerPlatform'
# ...
# Anywhere 

$em->getConnection()->createSchemaManager();

Expected behaviour

The assert should not fail, I guess it should be replaced by the new class instead of the deprecated one :

# \Doctrine\DBAL\Driver\AbstractSQLServerDriver: line 43
assert($platform instanceof SQLServerPlatform);
@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants