Checks the uniqueness of the given fields, returns true if its unique
public validateUnique ( FOS\UserBundle\Model\UserInterface $value, |
||
$value | FOS\UserBundle\Model\UserInterface | |
$constraint | ||
return | boolean |
/** * Checks if the passed value is valid. * * @param mixed $value The value that should be validated * @param Constraint $constraint The constrain for the validation * * @return Boolean Whether or not the value is valid * * @throws UnexpectedTypeException if $value is not instance of \FOS\UserBundle\Model\UserInterface */ public function isValid($value, Constraint $constraint) { if (!$value instanceof UserInterface) { throw new UnexpectedTypeException($value, 'FOS\\UserBundle\\Model\\UserInterface'); } if (!$this->userManager->validateUnique($value, $constraint)) { $this->setMessage($constraint->message, array('%property%' => $constraint->property)); return false; } return true; }