Ejemplo n.º 1
0
 /**
  * Load validator metadata
  * 
  * @param Symfony\Component\Validator\Mapping\ClassMetadata $metadata
  */
 public static function loadValidatorMetadata(ClassMetadata $metadata)
 {
     $metadata->addPropertyConstraint('created', new Assert\NotBlank());
     $metadata->addPropertyConstraint('title', new Assert\NotBlank());
     $metadata->addPropertyConstraint('title', new Assert\Length(array('min' => 5)));
     $metadata->addPropertyConstraint('body', new Assert\NotBlank());
 }
Ejemplo n.º 2
0
 public static function loadValidatorMetadata(ClassMetadata $metadata)
 {
     $metadata->addPropertyConstraint('name', new NotBlank());
     $metadata->addPropertyConstraint('email', new NotBlank());
     $metadata->addPropertyConstraint('email', new Email(array('message' => 'Please provide a valid email address.')));
     $metadata->addPropertyConstraint('subject', new NotBlank());
 }
Ejemplo n.º 3
0
 public static function loadValidatorMetadata(ClassMetadata $metadata)
 {
     $metadata->addPropertyConstraint('name', new NotBlank());
     $metadata->addPropertyConstraint('name', new Length(['min' => 5, 'max' => 10, 'minMessage' => 'Your name must be at least {{ limit }} characters long', 'maxMessage' => 'Your name cannot be longer than {{ limit }} characters']));
     $metadata->addPropertyConstraint('password', new NotBlank());
     $metadata->addPropertyConstraint('password', new Length(['min' => 5, 'max' => 10, 'minMessage' => 'Your password must be at least {{ limit }} characters long', 'maxMessage' => 'Your password cannot be longer than {{ limit }} characters']));
 }
Ejemplo n.º 4
0
 public static function loadValidatorMetadata(ClassMetadata $metadata)
 {
     $metadata->addPropertyConstraint('title', new NotBlank());
     $metadata->addPropertyConstraint('coment', new NotBlank());
     $metadata->addPropertyConstraint('author', new NotBlank());
     $metadata->addPropertyConstraint('photo', new NotBlank());
 }
Ejemplo n.º 5
0
 public static function loadValidatorMetadata(ClassMetadata $metadata)
 {
     $metadata->addPropertyConstraint('teamA', new Assert\Valid());
     $metadata->addPropertyConstraint('teamB', new Assert\Valid());
     $metadata->addPropertyConstraint('setScores', new Assert\Valid());
     $metadata->addPropertyConstraint('gameTimeLengthInSeconds', new Assert\Range(['min' => 0, 'max' => 65535]));
 }
Ejemplo n.º 6
0
 public static function loadValidatorMetadata(ClassMetadata $metadata)
 {
     $metadata->addPropertyConstraint('name', new Assert\NotBlank());
     $metadata->addPropertyConstraint('name', new Assert\Length(['max' => 32]));
     $metadata->addPropertyConstraint('description', new Assert\NotBlank());
     $metadata->addPropertyConstraint('description', new Assert\Length(['max' => 255]));
 }
Ejemplo n.º 7
0
 /**
  * @param ClassMetadata $metadata
  */
 public static function loadValidatorMetadata(ClassMetadata $metadata)
 {
     $metadata->addPropertyConstraint('title', new NotBlank(array('message' => 'You must enter a title')));
     $metadata->addPropertyConstraint('blog', new NotBlank(array('message' => 'You must enter little bit blog?')));
     $metadata->addPropertyConstraint('author', new NotBlank(array('message' => 'You must enter your name!')));
     $metadata->addPropertyConstraint('tags', new NotBlank(array('message' => 'You must enter minimal one tag')));
 }
 public static function loadValidatorMetadata(ClassMetadata $metadata)
 {
     $metadata->addPropertyConstraint('column', new Assert\NotBlank());
     $metadata->addPropertyConstraint('column', new Assert\Type(['type' => 'integer']));
     $metadata->addPropertyConstraint('dir', new Assert\NotBlank());
     $metadata->addPropertyConstraint('dir', new Assert\Choice(['choices' => ['asc', 'desc']]));
 }
 public static function loadValidatorMetadata(ClassMetadata $metadata)
 {
     $metadata->addPropertyConstraint('login', new NotBlank());
     $metadata->addPropertyConstraint('login', new Length(array('min' => 6, 'max' => 40)));
     $metadata->addPropertyConstraint('email', new Length(array('min' => 2, 'max' => 100)));
     $metadata->addPropertyConstraint('email', new Email());
 }
Ejemplo n.º 10
0
 public static function loadValidatorMetadata(ClassMetadata $metadata)
 {
     $metadata->addPropertyConstraint('name', new Assert\NotBlank());
     $metadata->addPropertyConstraint('name', new Assert\Length(['max' => 255]));
     $metadata->addPropertyConstraint('sortOrder', new Assert\NotNull());
     $metadata->addPropertyConstraint('sortOrder', new Assert\Range(['min' => 0, 'max' => 65535]));
 }
Ejemplo n.º 11
0
 public static function loadValidatorMetadata(ClassMetadata $metadata)
 {
     $metadata->addPropertyConstraint('name', new NotBlank());
     $metadata->addPropertyConstraint('email', new Email());
     $metadata->addPropertyConstraint('short_name', new NotBlank());
     $metadata->addPropertyConstraint('address', new NotBlank());
 }
Ejemplo n.º 12
0
 public static function loadValidatorMetadata(ClassMetadata $metadata)
 {
     $metadata->addPropertyConstraint('name', new Constraints\NotBlank());
     $metadata->addPropertyConstraint('name', new Constraints\MinLength(2));
     $metadata->addPropertyConstraint('username', new Constraints\NotBlank());
     $metadata->addPropertyConstraint('username', new Constraints\MinLength(2));
 }
Ejemplo n.º 13
0
 public static function loadValidatorMetadata(ClassMetadata $metadata)
 {
     $metadata->addPropertyConstraint('title', new NotBlank(array('message' => 'You must enter a title')));
     $metadata->addPropertyConstraint('author', new NotBlank(array('message' => 'You must enter a author')));
     $metadata->addPropertyConstraint('blog', new NotBlank(array('message' => 'You must enter the text')));
     $metadata->addPropertyConstraint('blog', new Length(array('min' => 50)));
 }
 public static function loadValidatorMetadata(ClassMetadata $metadata)
 {
     $metadata->addConstraint(new Callback('validate'));
     $metadata->addPropertyConstraint('password', new NotBlank());
     $metadata->addPropertyConstraint('password', new Length(array('min' => 8, 'max' => 40)));
     $metadata->addPropertyConstraint('repeatPassword', new NotBlank());
     $metadata->addPropertyConstraint('repeatPassword', new Length(array('min' => 8, 'max' => 40)));
 }
Ejemplo n.º 15
0
 public static function loadValidatorMetadata(ClassMetadata $metadata)
 {
     $metadata->addPropertyConstraint('nom', new NotBlank());
     $metadata->addPropertyConstraint('email', new Email());
     $metadata->addPropertyConstraint('sujet', new NotBlank());
     $metadata->addPropertyConstraint('sujet', new Length(array('max' => 50)));
     $metadata->addPropertyConstraint('message', new Length(array('min' => 50)));
 }
Ejemplo n.º 16
0
 public static function loadValidatorMetadata(ClassMetadata $metadata)
 {
     $metadata->addPropertyConstraint('name', new NotBlank());
     $metadata->addPropertyConstraint('email', new Email());
     $metadata->addPropertyConstraint('subject', new NotBlank());
     $metadata->addPropertyConstraint('subject', new Length(array('min' => 2, 'max' => 150, 'minMessage' => 'Data must be at least {{ limit }} characters length', 'maxMessage' => 'Data cannot be longer than {{ limit }} characters length')));
     $metadata->addPropertyConstraint('body', new Length(array('min' => 2, 'max' => 500, 'minMessage' => 'Data must be at least {{ limit }} characters length', 'maxMessage' => 'Data cannot be longer than {{ limit }} characters length')));
 }
Ejemplo n.º 17
0
 /**
  * Validator
  */
 public static function loadValidatorMetadata(ClassMetadata $metadata)
 {
     $metadata->addPropertyConstraint('zip', new Assert\NotBlank(array('groups' => array('all', 'BasicInformation'))));
     $metadata->addPropertyConstraint('prefecture', new Assert\NotBlank(array('groups' => array('all', 'BasicInformation'))));
     $metadata->addPropertyConstraint('city', new Assert\NotBlank(array('groups' => array('all', 'BasicInformation'))));
     $metadata->addPropertyConstraint('line1', new Assert\NotBlank(array('groups' => array('all', 'BasicInformation'))));
     $metadata->addPropertyConstraint('line2', new Assert\NotBlank(array('groups' => array('all', 'BasicInformation'))));
 }
Ejemplo n.º 18
0
 public static function loadValidatorMetadata(ClassMetadata $metadata)
 {
     $metadata->addPropertyConstraint('name', new Assert\NotBlank());
     $metadata->addPropertyConstraint('name', new Assert\Length(['max' => 255]));
     $metadata->addPropertyConstraint('code', new Assert\NotBlank());
     $metadata->addPropertyConstraint('code', new Assert\Length(['max' => 255]));
     $metadata->addPropertyConstraint('warehouse', new Assert\Valid());
 }
Ejemplo n.º 19
0
 public static function loadValidatorMetadata(ClassMetadata $metadata)
 {
     $metadata->addPropertyConstraint('name', new Assert\NotBlank());
     $metadata->addPropertyConstraint('email', new Assert\Email(array('message' => 'The email {{ value }} is not a valid email.', 'checkMX' => true)));
     $metadata->addPropertyConstraint('subject', new Assert\NotBlank());
     $metadata->addPropertyConstraint('subject', new Assert\Length(array('max' => 50, 'maxMessage' => 'This field cannot be longer than {{ limit }} characters')));
     $metadata->addPropertyConstraint('body', new Assert\Length(array('min' => 50, 'minMessage' => 'This field must be at least {{ limit }} characters long.')));
 }
Ejemplo n.º 20
0
 public static function loadValidatorMetadata(ClassMetadata $metadata)
 {
     $metadata->addPropertyConstraint('name', new NotBlank());
     $metadata->addPropertyConstraint('email', new Email(array('message' => 'This sweet blog does not like invalid emails. Give me a real one!')));
     $metadata->addPropertyConstraint('subject', new NotBlank());
     $metadata->addPropertyConstraint('subject', new Assert\Length(array('max' => 50, 'min' => 5)));
     $metadata->addPropertyConstraint('body', new Assert\Length(array('max' => 1000, 'min' => 50, 'minMessage' => 'Your message must be at least {{ limit }} characters long', 'maxMessage' => 'Your message cannot be longer than {{ limit }} characters')));
 }
Ejemplo n.º 21
0
 public static function loadValidatorMetadata(ClassMetadata $metadata)
 {
     $metadata->addPropertyConstraint('name', new NotBlank());
     $metadata->addPropertyConstraint('email', new Email(array('message' => 'Email invalide !')));
     $metadata->addPropertyConstraint('subject', new NotBlank());
     $metadata->addPropertyConstraint('subject', new Length(array('min' => 0, 'max' => 50)));
     $metadata->addPropertyConstraint('body', new Length(array('min' => 20, 'max' => 600)));
 }
Ejemplo n.º 22
0
 public static function loadValidatorMetadata(ClassMetadata $metadata)
 {
     $metadata->addPropertyConstraint('name', new NotBlank());
     $metadata->addPropertyConstraint('email', new Email());
     $metadata->addPropertyConstraint('subject', new NotBlank());
     $metadata->addPropertyConstraint('subject', new Assert\Length(array('max' => 50)));
     $metadata->addPropertyConstraint('body', new Assert\Length(array('min' => 50)));
 }
Ejemplo n.º 23
0
 public static function loadValidatorMetadata(ClassMetadata $metadata)
 {
     $metadata->addPropertyConstraint('name', new NotBlank());
     $metadata->addPropertyConstraint('email', new Email(['message' => 'Symblog does not like invalid emails']));
     $metadata->addPropertyConstraint('subject', new NotBlank());
     $metadata->addPropertyConstraint('subject', new Length(['max' => 50]));
     $metadata->addPropertyConstraint('body', new Length(['min' => 50]));
 }
 /**
  * @dataProvider guessRequiredProvider
  */
 public function testGuessRequired($constraint, $guess)
 {
     // add distracting constraint
     $this->metadata->addPropertyConstraint(self::TEST_PROPERTY, new Email());
     // add constraint under test
     $this->metadata->addPropertyConstraint(self::TEST_PROPERTY, $constraint);
     $this->assertEquals($guess, $this->guesser->guessRequired(self::TEST_CLASS, self::TEST_PROPERTY));
 }
Ejemplo n.º 25
0
 public static function loadValidatorMetadata(ClassMetadata $metadata)
 {
     $metadata->addPropertyConstraint('name', new NotBlank());
     $metadata->addPropertyConstraint('email', new Email(array('message' => 'symblog does not like invalid emails. Give me a real one!')));
     $metadata->addPropertyConstraint('subject', new NotBlank());
     $metadata->addPropertyConstraint('subject', new Length(array('min' => '0', 'max' => '50')));
     $metadata->addPropertyConstraint('body', new Length(array('min' => '50', 'max' => '255')));
 }
Ejemplo n.º 26
0
 public static function loadValidatorMetadata(ClassMetadata $metadata)
 {
     $integerColumns = ['origSubtotal', 'subtotal', 'taxSubtotal', 'discount', 'shipping', 'shippingDiscount', 'tax', 'total', 'savings'];
     foreach ($integerColumns as $columnName) {
         $metadata->addPropertyConstraint($columnName, new Assert\NotNull());
         $metadata->addPropertyConstraint($columnName, new Assert\Range(['min' => 0, 'max' => 4294967295]));
     }
 }
Ejemplo n.º 27
0
 public static function loadValidatorMetadata(ClassMetadata $metadata)
 {
     $metadata->addConstraint(new Callback('checkPassword'));
     $metadata->addPropertyConstraint('password', new NotBlank());
     $metadata->addPropertyConstraint('password', new Length(array('min' => 8, 'max' => 40)));
     $metadata->addPropertyConstraint('email', new Length(array('min' => 2, 'max' => 100)));
     $metadata->addPropertyConstraint('email', new Email());
 }
Ejemplo n.º 28
0
 public static function loadValidatorMetadata(ClassMetadata $metadata)
 {
     $metadata->addPropertyConstraint('email', new Assert\NotBlank());
     $metadata->addPropertyConstraint('email', new Assert\Length(['max' => 255]));
     $metadata->addPropertyConstraint('ip4', new Assert\NotBlank());
     $metadata->addPropertyConstraint('ip4', new Assert\GreaterThanOrEqual(['value' => 0]));
     $metadata->addPropertyConstraint('result', new Assert\Valid());
 }
Ejemplo n.º 29
0
 public static function loadValidatorMetadata(ClassMetadata $metadata)
 {
     $metadata->addPropertyConstraint('name', new NotBlank());
     $metadata->addPropertyConstraint('email', new Email());
     $metadata->addPropertyConstraint('subject', new NotBlank());
     $metadata->addPropertyConstraint('subject', new MaxLength(50));
     $metadata->addPropertyConstraint('body', new MinLength(50));
 }
Ejemplo n.º 30
0
 public static function loadValidatorMetadata(ClassMetadata $metadata)
 {
     $metadata->addPropertyConstraint('name', new Assert\Length(['max' => 255]));
     $metadata->addPropertyConstraint('type', new Assert\Valid());
     $metadata->addPropertyConstraint('value', new Assert\Range(['min' => 0, 'max' => 4294967295]));
     self::loadPromotionRedemptionValidatorMetadata($metadata);
     self::loadPromotionStartEndDateValidatorMetadata($metadata);
 }