当前位置: 首页>>代码示例>>PHP>>正文


PHP ClassMetadata::addPropertyConstraints方法代码示例

本文整理汇总了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()]);
 }
开发者ID:Covert-Inferno,项目名称:evetool,代码行数:4,代码来源:Corporation.php

示例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());
 }
开发者ID:snikolow,项目名称:silex-issue-tracker,代码行数:9,代码来源:Issue.php

示例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()]);
 }
开发者ID:Covert-Inferno,项目名称:evetool,代码行数:4,代码来源:User.php

示例4: loadValidatorMetadata

 /**
  * @param ClassMetadata $metadata
  */
 public static function loadValidatorMetadata(ClassMetadata $metadata)
 {
     $metadata->addPropertyConstraints('source', [new NotBlank()]);
 }
开发者ID:kisphp,项目名称:api.tools.symfony,代码行数:7,代码来源:ApiFormTransfer.php

示例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])]);
 }
开发者ID:pgdba,项目名称:cg,代码行数:12,代码来源:User.php

示例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());
 }
开发者ID:snikolow,项目名称:silex-issue-tracker,代码行数:5,代码来源:IssueStatus.php

示例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)));
 }
开发者ID:snikolow,项目名称:silex-issue-tracker,代码行数:6,代码来源:Project.php

示例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')));
 }
开发者ID:snikolow,项目名称:silex-issue-tracker,代码行数:7,代码来源:User.php

示例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])]);
 }
开发者ID:Covert-Inferno,项目名称:evetool,代码行数:4,代码来源:ApiCredentials.php


注:本文中的Symfony\Component\Validator\Mapping\ClassMetadata::addPropertyConstraints方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。