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

Inconsistent SchemaManager API across platforms #4503

Closed
morozov opened this issue Feb 21, 2021 · 1 comment · Fixed by #4577, #4548 or #4598
Closed

Inconsistent SchemaManager API across platforms #4503

morozov opened this issue Feb 21, 2021 · 1 comment · Fixed by #4577, #4548 or #4598

Comments

@morozov
Copy link
Member

morozov commented Feb 21, 2021

Some ShemaManager subclasses have public methods that don't exist in the base class, e.g. PostgreSQLSchemaManager#getSchemaNames().

The downside of this is that it's impossible to analyze such code statically:

DriverManager::getConnection($params)->getSchemaManager()->getSchemaNames();
  1. If your code works only with PostgreSQL, you'll need to make a type assertion before calling the method:
    assert($this->schemaManager instanceof PostgreSqlSchemaManager);
  2. If your code is supposed to work with multiple platforms, then you'll have to implement the API missing in other platforms yourself which is a result of leaky abstraction.

Not sure if it's possible to enforce it via automation, but for the classes that are instantiated dynamically (drivers, platforms) we should be aiming towards not allowing the methods that aren't described in the base class or implemented interface(s).

So far, the following can be improved:

  1. PostgreSQLSchemaManager#getSchemaNames() – could be declared in the base class with an empty implementation.
  2. PostgreSQLSchemaManager#getExistingSchemaSearchPaths() , PostgreSQLSchemaManager#determineExistingSchemaSearchPaths(), OracleSchemaManager#dropAutoincrement()– used only internally by a protected method. Could be marked internal and then made protected in the next major.
@morozov morozov added this to the 4.0.0 milestone Mar 23, 2021
morozov added a commit to morozov/dbal that referenced this issue Apr 1, 2021
morozov added a commit to morozov/dbal that referenced this issue Apr 2, 2021
@morozov morozov linked a pull request Apr 2, 2021 that will close this issue
@morozov morozov linked a pull request Apr 2, 2021 that will close this issue
morozov added a commit to morozov/dbal that referenced this issue Apr 2, 2021
morozov added a commit to morozov/dbal that referenced this issue Apr 2, 2021
morozov added a commit to morozov/dbal that referenced this issue Apr 3, 2021
morozov added a commit to morozov/dbal that referenced this issue Apr 3, 2021
morozov added a commit that referenced this issue Apr 4, 2021
[GH-4503] Mark OracleSchemaManager methods internal
morozov added a commit to morozov/dbal that referenced this issue Apr 10, 2021
morozov added a commit that referenced this issue Apr 10, 2021
[GH-4503] Make OracleSchemaManager::dropAutoincrement() protected
@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 Jul 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.