In EasyAdminBundle, do you know a way to check if there is an entity duplicate before letting EasyAdminBundle perform the "persist & flush".
Trial : I tried to override the AdminController and added prePersistEntity() containing my "duplicate check" logic, but I failed at setting a redirection when detecting an upcoming doublon. The prePersist event logic continue to execute the "newAction()" code and finally "persist & flush", ignoring my redirection.
How to manage properly duplicate check and setting a redirection within the EasyAdmin overriding logic?
Thanks.
I think your problem is related to a missing check for duplicate on your entity. To avoid duplicate you have to use the @UniqueEntity annotation.
There is an official documentation on how to implement it : https://symfony.com/doc/current/reference/constraints/UniqueEntity.html