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

Doctrine 2: Deprecation annotation gives a broken suggestion of what to change #11244

Closed
rrehbein opened this issue Feb 9, 2024 · 0 comments
Closed

Comments

@rrehbein
Copy link
Contributor

rrehbein commented Feb 9, 2024

Bug Report

Q A
BC Break no?
Version 2.18.0

Summary

Following the suggestion in the deprecation notice about which class name to use for 'catch' does not actually work.

Current behavior

Changing catches to Doctrine\ORM\Exception\ORMException per the deprecation notice causes the catches to be ignored.

How to reproduce

<?php

require 'vendor/autoload.php';

try {
    throw \Doctrine\ORM\Exception\ORMException::namedQueryNotFound('demo');
} catch (\Doctrine\ORM\Exception\ORMException $ex) {
    // This is what we are told to change to based on:
    // Note in: src/ORMException.php
    // @deprecated Use Doctrine\ORM\Exception\ORMException for catch and instanceof
    echo "The suggested catch caught\n";
}

Expected behavior

output: The suggested catch caught

Actual behavior

Fatal error: Uncaught Doctrine\ORM\ORMException: Could not find a named query by the name "demo" in /tmp/d/vendor/doctrine/orm/src/ORMException.php:42
Stack trace:
#0 Standard input code(6): Doctrine\ORM\ORMException::namedQueryNotFound()
#1 {main}
  thrown in /tmp/d/vendor/doctrine/orm/src/ORMException.php on line 42
@rrehbein rrehbein changed the title Deprecation annotation gives a broken suggestion of what to change Doctrine 2: Deprecation annotation gives a broken suggestion of what to change Feb 9, 2024
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

No branches or pull requests

2 participants