Guest User

Untitled

a guest
May 22nd, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.57 KB | None | 0 0
  1. <?php
  2.  
  3. namespace My\UserBundle\Validator;
  4.  
  5. use Symfony\Component\Validator\Constraint;
  6.  
  7. class Unique extends Constraint
  8. {
  9.     public $message = 'The value for "%property%" already exists.';
  10.     public $property;
  11.  
  12.     public function defaultOption()
  13.     {
  14.         return 'property';
  15.     }
  16.  
  17.     public function requiredOptions()
  18.     {
  19.         return array('property');
  20.     }
  21.  
  22.     public function validatedBy()
  23.     {
  24.         return 'my_user.validator.unique';
  25.     }
  26.    
  27.     public function getTargets()
  28.     {
  29.         return self::CLASS_CONSTRAINT;
  30.     }
  31. }
Add Comment
Please, Sign In to add comment