You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Following from #7759, it is not possible to use the feature when the exception is of type ModelManagerException, even though these implement ModelManagerThrowable, as is the case for Doctrine UniqueConstraintViolationExceptions.
This is because, in CRUDController.php ModelManagerExceptions are caught first, before the catch for ModelManagerThrowable.
The relevant catches have been marked for removal for the last couple of years // NEXT_MAJOR: Remove this catch. but persist in the current 4.x and 5.x branches.
Currently, I'm having to hack around this issue by overriding addFlash, disabling the call to the CRUDController method for cases where I want to customise the message and storing the custom message in the admin (if there is one) so that I can retrieve it in the controller, before re-enabling the call to the CRUDController afterwards.
I see three possible clean resolutions to this:
remove the catch blocks that have been earmarked since 2021 (this may have B.C. issues for some projects);
swap the ordering of the ModelManagerThrowable and ModelManagerException catch blocks so that ModelManagerThrowable is handled first;
apply a similar interface to handleModelManagerException so that it can also return a customised string.
I prefer option 3... is there any reason why this was not done at the same time as #7761 ?
The text was updated successfully, but these errors were encountered:
Hey @VincentLanglet I was having trouble getting handleModelManagerThrowable to customise the flashbag message on error and came up with the proposed PR #8141
Feature Request
Following from #7759, it is not possible to use the feature when the exception is of type ModelManagerException, even though these implement ModelManagerThrowable, as is the case for Doctrine UniqueConstraintViolationExceptions.
This is because, in CRUDController.php ModelManagerExceptions are caught first, before the catch for ModelManagerThrowable.
The relevant catches have been marked for removal for the last couple of years
// NEXT_MAJOR: Remove this catch.
but persist in the current 4.x and 5.x branches.Currently, I'm having to hack around this issue by overriding addFlash, disabling the call to the CRUDController method for cases where I want to customise the message and storing the custom message in the admin (if there is one) so that I can retrieve it in the controller, before re-enabling the call to the CRUDController afterwards.
I see three possible clean resolutions to this:
I prefer option 3... is there any reason why this was not done at the same time as #7761 ?
The text was updated successfully, but these errors were encountered: