Description
Hello,
The UniqueEntity constraint is useful to check whether a similar entity already exists in the database.
But suppose this constraint is used inside a collection (via embedded forms for instance). In this case, the constraint is not able to detect duplicates within the non-persisted entities.
See this issue in the Symfony repository.
In the current documentation, we can read that the constraint Validates that a particular field (or fields) in a Doctrine entity is (are) unique. I think it can be confusing.
What do you think of adding a warning message regarding this use case? (imho it's something different that the existing race-conditions warning message).
Something like: "When used inside a collection, the UniqueConstraint cannot deal with duplicates whithin the non already persited entities. You have to implement your own validator in order to handle this situation.".
Thank you for reading!
Fabien