mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
[PR #9686] added missing exception type for deletions #11800
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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 inUnitOfWork#commit(), those are catched viaThrowableand 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
ForeignKeyConstraintViolationExceptionin the catch():(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.