[FLOW3-general] Validate if an object is unique
Bastian Waidelich
bastian at typo3.org
Thu Feb 28 14:15:41 CET 2013
Widmer Cornel wrote:
Hi,
> I tried to validate on the controller-action with "UniqueEntity" but
> then i got the error: "The object supplied for the UniqueEntityValidator
> must have at least one identity property."
If you look at the code of the UniqueEntityValidator [1] (which is
always a good idea btw) you can see that the exception is only thrown if
the Entity doesn't contain properties marked as @ORM\Identity *and* the
"identityProperties" option is not specified.
Try
@Flow\Validate(argumentName="$user", type="UniqueEntity",
options={"identityProperties"={"emailAddress"}})
[1]
http://git.typo3.org/FLOW3/Packages/TYPO3.FLOW3.git/blob/master:/Classes/TYPO3/Flow/Validation/Validator/UniqueEntityValidator.php
--
Bastian Waidelich
--
Core Developer Team
TYPO3 .... inspiring people to share!
Get involved: typo3.org
More information about the FLOW3-general
mailing list