New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some Documentation for UniqueEntity constraint #873
Comments
I've added some clarifications and fixes per your notes here. Can you take a look at them and see if you can see any issues? Thanks! |
Looks good. You may want to add a short blurb explaining that to get unique validation on multiple fields in the entity, you need to replicate the entire constraint tag block, once for each field. |
Yes, the wording of the explanation for the "fields" parameter is a bit ambiguous
To me, this sounds like the fields you pass to a single UniqueEntity statement will separately be checked for uniqueness in the table, rather than as combination, which I believe is what happens. |
@mrtorrent I agree! I've just made this language much more clear. Thanks guys! |
The following should be added:
First, you also need to add a use statement to your entity as follows:
Second, in your xml file, the constraint is specified a little differently than other constraints. The constraint tag is not placed within the property tag, but is right under the class tag, at the same level as the property tag.
Third, in your constraint tag, you need to specify the full pathname to the constraint . You can't just say UniqueEntity.
Finally, if you want multiple fields within the entity to be unique, you need separate constraint tags.
Here is an example:
The text was updated successfully, but these errors were encountered: