本文整理汇总了PHP中Symfony\Component\Validator\Mapping\ClassMetadata::addPropertyConstraints方法的典型用法代码示例。如果您正苦于以下问题:PHP ClassMetadata::addPropertyConstraints方法的具体用法?PHP ClassMetadata::addPropertyConstraints怎么用?PHP ClassMetadata::addPropertyConstraints使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\Validator\Mapping\ClassMetadata
的用法示例。
在下文中一共展示了ClassMetadata::addPropertyConstraints方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadValidatorMetadata
public static function loadValidatorMetadata(ClassMetadata $metadata)
{
$metadata->addPropertyConstraints('api_credentials', [new Assert\Valid()]);
}
示例2: loadValidatorMetadata
/**
*
* @param ClassMetadata $metadata
*/
public static function loadValidatorMetadata(ClassMetadata $metadata)
{
$metadata->addPropertyConstraints('subject', array(new Assert\NotBlank(), new Assert\Length(array('min' => 3))));
$metadata->addPropertyConstraint('description', new Assert\NotBlank());
}
示例3: loadValidatorMetadata
public static function loadValidatorMetadata(ClassMetadata $metadata)
{
$metadata->addPropertyConstraints('username', [new Assert\NotBlank()])->addPropertyConstraints('email', [new Assert\Email(), new Assert\NotBlank(), new DuplicateEmailConstraint(['groups' => 'new'])])->addPropertyConstraints('plainPassword', [new Assert\NotBlank(['groups' => 'new'])])->addPropertyConstraints('roles', [new Assert\NotBlank()]);
}
示例4: loadValidatorMetadata
/**
* @param ClassMetadata $metadata
*/
public static function loadValidatorMetadata(ClassMetadata $metadata)
{
$metadata->addPropertyConstraints('source', [new NotBlank()]);
}
示例5: loadValidatorMetadata
/**
* @param ClassMetadata $metadata
*/
public static function loadValidatorMetadata(ClassMetadata $metadata)
{
$metadata->addPropertyConstraints('name', [new Assert\NotBlank(), new Assert\Length(['min' => 2])]);
$metadata->addPropertyConstraints('surname', [new Assert\NotBlank(), new Assert\Length(['min' => 2])]);
$metadata->addPropertyConstraints('phone', [new Assert\NotBlank(), new Assert\Regex(['pattern' => '/^\\d*$/', 'message' => 'Phone should have only digits'])]);
$metadata->addPropertyConstraints('address', [new Assert\NotBlank(), new Assert\Length(['min' => 2])]);
$metadata->addPropertyConstraints('zip', [new Assert\NotBlank(), new Assert\Length(['min' => 2])]);
$metadata->addPropertyConstraints('city', [new Assert\NotBlank(), new Assert\Length(['min' => 2])]);
}
示例6: loadValidatorMetadata
public static function loadValidatorMetadata(ClassMetadata $metadata)
{
$metadata->addPropertyConstraints('title', array(new Assert\NotBlank(), new Assert\Length(array('min' => 3))));
$metadata->addPropertyConstraint('className', new Assert\NotBlank());
}
示例7: loadValidatorMetadata
public static function loadValidatorMetadata(ClassMetadata $metadata)
{
$metadata->addPropertyConstraints('title', array(new Assert\NotBlank(), new Assert\Length(array('min' => 3, 'max' => 50))));
$metadata->addPropertyConstraint('description', new Assert\NotBlank());
$metadata->addPropertyConstraint('trackers', new Assert\Count(array('min' => 1)));
}
示例8: loadValidatorMetadata
public static function loadValidatorMetadata(ClassMetadata $metadata)
{
$metadata->addPropertyConstraints('email', array(new Assert\NotBlank(), new Assert\Length(array('min' => 3, 'max' => 50)), new Assert\Email()));
$metadata->addPropertyConstraint('name', new Assert\NotBlank());
$metadata->addPropertyConstraints('password', array(new Assert\NotBlank(), new Assert\Length(array('min' => 6))));
$metadata->addConstraint(new UniqueEntity(array('fields' => 'email')));
}
示例9: loadValidatorMetadata
public static function loadValidatorMetadata(ClassMetadata $metadata)
{
$metadata->addPropertyConstraints('api_key', [new Assert\NotBlank()])->addPropertyConstraints('verification_code', [new Assert\NotBlank(), new Assert\Length(['min' => 64, 'max' => 64])]);
}