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

The portability spans two different architecture layers and doesn't properly implement the wrapper API #4156

Closed
morozov opened this issue Jul 9, 2020 · 2 comments · Fixed by #4157

Comments

@morozov
Copy link
Member

morozov commented Jul 9, 2020

Q A
BC Break no
Version 3.0.0-dev

As reported by PHPStan in #4094 (2.10.x),

dbal/phpstan.neon.dist

Lines 99 to 102 in 15d9be0

-
message: '~Method Doctrine\\DBAL\\Portability\\Connection::prepare\(\) should return Doctrine\\DBAL\\Statement but returns Doctrine\\DBAL\\Portability\\Statement\.~'
paths:
- %currentWorkingDirectory%/lib/Doctrine/DBAL/Portability/Connection.php

In 3.0.x where the driver and wrapper APIs started diverging (#4045), it results in the following:

$conn = DriverManager::getConnection([
    'driver' => 'pdo_sqlite',
]);

foreach ($conn->prepare('SELECT 1')->execute()->iterateColumn() as $value) {
    var_dump($value);
}

// string(1) "1"

$conn = DriverManager::getConnection([
    'driver' => 'pdo_sqlite',
    'wrapperClass' => \Doctrine\DBAL\Portability\Connection::class,
    'portability'  => \Doctrine\DBAL\Portability\Connection::PORTABILITY_ALL,
    'fetch_case'   => \Doctrine\DBAL\ColumnCase::LOWER,
]);

foreach ($conn->prepare('SELECT 1')->execute()->iterateColumn() as $value) {
    var_dump($value);
}

// Fatal error: Call to undefined method Doctrine\DBAL\Portability\Result::iterateColumn()
@morozov
Copy link
Member Author

morozov commented Jul 11, 2020

Closed via #4157.

@morozov morozov closed this as completed Jul 11, 2020
@morozov morozov self-assigned this Aug 7, 2020
@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 29, 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.

1 participant