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

Throws a deprecation notice with Doctrine ORM ^2.14 #234

Closed
fatalist opened this issue Nov 29, 2023 · 2 comments · Fixed by #262
Closed

Throws a deprecation notice with Doctrine ORM ^2.14 #234

fatalist opened this issue Nov 29, 2023 · 2 comments · Fixed by #262

Comments

@fatalist
Copy link

Doctrine\DBAL\Connection::exec is deprecated, please use executeStatement() instead. (Connection.php:1995 called by Purger.php:107, https://github.com/doctrine/dbal/pull/4163, package doctrine/dbal)

The following code:

// src/Bridge/Doctrine/Purger/Purger.php
if ($disableFkChecks) {
    $connection = $this->purger->getObjectManager()->getConnection();
    $connection->exec('SET FOREIGN_KEY_CHECKS = 0;');
}
$this->purger->purge();
if ($disableFkChecks && isset($connection)) {
    $connection->exec('SET FOREIGN_KEY_CHECKS = 1;');
}

Should be replaced with:

// src/Bridge/Doctrine/Purger/Purger.php
if ($disableFkChecks) {
    $connection = $this->purger->getObjectManager()->getConnection();
    $connection->executeStatement('SET FOREIGN_KEY_CHECKS = 0;');
}
$this->purger->purge();
if ($disableFkChecks && isset($connection)) {
    $connection->executeStatement('SET FOREIGN_KEY_CHECKS = 1;');
}
@alexislefebvre
Copy link
Contributor

The title says that it “Doesn't work” but the description shows a deprecation. Does it work even though there is a deprecation message?

@fatalist
Copy link
Author

The title says that it “Doesn't work” but the description shows a deprecation. Does it work even though there is a deprecation message?

It's my fault. The title is now correct.
It works, but with notices.

@fatalist fatalist changed the title Doesn't work with Doctrine ORM ^2.14 Throws a deprecation notice with Doctrine ORM ^2.14 Nov 29, 2023
theofidry added a commit that referenced this issue Dec 3, 2023
theofidry added a commit that referenced this issue Dec 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants