當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。