[PR #9686] added missing exception type for deletions #11800

Closed
opened 2026-01-22 16:11:57 +01:00 by admin · 0 comments
Owner

Original Pull Request: https://github.com/doctrine/orm/pull/9686

State: closed
Merged: No


Signed-off-by: Pascal Paulis ppaulis@gmail.com

Deletions can potentially throw Doctrine\DBAL\Exception\ForeignKeyConstraintViolationException. But in UnitOfWork#commit(), those are catched via Throwable and are rethrown after some closing operations.

So, currently, it's not evident for developers to see that they could get this type of exception.

This PR proposes to add the ForeignKeyConstraintViolationException in the catch():

} catch (Throwable | ForeignKeyConstraintViolationException $e) {

(supported since PHP 7.1 : https://wiki.php.net/rfc/multiple-catch, so no BC break)

and in the docBlock of UnitOfWork#commit().

Like this, IDEs and quality tools can signal potential problems with this kind of exception.

**Original Pull Request:** https://github.com/doctrine/orm/pull/9686 **State:** closed **Merged:** No --- Signed-off-by: Pascal Paulis <ppaulis@gmail.com> Deletions can potentially throw `Doctrine\DBAL\Exception\ForeignKeyConstraintViolationException`. But in `UnitOfWork#commit()`, those are catched via `Throwable` and are rethrown after some closing operations. So, currently, it's not evident for developers to see that they could get this type of exception. This PR proposes to add the `ForeignKeyConstraintViolationException` in the catch(): ```php } catch (Throwable | ForeignKeyConstraintViolationException $e) { ``` (supported since PHP 7.1 : https://wiki.php.net/rfc/multiple-catch, so no BC break) and in the docBlock of `UnitOfWork#commit()`. Like this, IDEs and quality tools can signal potential problems with this kind of exception.
admin added the pull-request label 2026-01-22 16:11:57 +01:00
admin closed this issue 2026-01-22 16:11:57 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#11800