本文整理汇总了PHP中Symfony\Component\Validator\Mapping\ClassMetadata::addPropertyConstraint方法的典型用法代码示例。如果您正苦于以下问题:PHP ClassMetadata::addPropertyConstraint方法的具体用法?PHP ClassMetadata::addPropertyConstraint怎么用?PHP ClassMetadata::addPropertyConstraint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\Validator\Mapping\ClassMetadata
的用法示例。
在下文中一共展示了ClassMetadata::addPropertyConstraint方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadValidatorMetadata
/**
* 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());
}
示例2: loadValidatorMetadata
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());
}
示例3: loadValidatorMetadata
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']));
}
示例4: loadValidatorMetadata
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());
}
示例5: loadValidatorMetadata
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]));
}
示例6: loadValidatorMetadata
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]));
}
示例7: loadValidatorMetadata
/**
* @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')));
}
示例8: loadValidatorMetadata
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']]));
}
示例9: loadValidatorMetadata
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());
}
示例10: loadValidatorMetadata
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]));
}
示例11: loadValidatorMetadata
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());
}
示例12: loadValidatorMetadata
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));
}
示例13: loadValidatorMetadata
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)));
}
示例14: loadValidatorMetadata
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)));
}
示例15: loadValidatorMetadata
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)));
}