本文整理匯總了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])]);
}