vendor/bundles/FOS/UserBundle/Validator/Unique.php
changeset 3 e54dfe4d0b2b
equal deleted inserted replaced
2:806e57d67020 3:e54dfe4d0b2b
       
     1 <?php
       
     2 
       
     3 /*
       
     4  * This file is part of the FOSUserBundle package.
       
     5  *
       
     6  * (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>
       
     7  *
       
     8  * For the full copyright and license information, please view the LICENSE
       
     9  * file that was distributed with this source code.
       
    10  */
       
    11 
       
    12 namespace FOS\UserBundle\Validator;
       
    13 
       
    14 use Symfony\Component\Validator\Constraint;
       
    15 
       
    16 /**
       
    17  * @Annotation
       
    18  */
       
    19 class Unique extends Constraint
       
    20 {
       
    21     public $message = 'The value for "%property%" already exists.';
       
    22     public $property;
       
    23 
       
    24     public function defaultOption()
       
    25     {
       
    26         return 'property';
       
    27     }
       
    28 
       
    29     public function requiredOptions()
       
    30     {
       
    31         return array('property');
       
    32     }
       
    33 
       
    34     public function validatedBy()
       
    35     {
       
    36         return 'fos_user.validator.unique';
       
    37     }
       
    38 
       
    39     /**
       
    40      * {@inheritDoc}
       
    41      */
       
    42     public function getTargets()
       
    43     {
       
    44         return self::CLASS_CONSTRAINT;
       
    45     }
       
    46 }