當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ClassMetadata::addPropertyConstraint方法代碼示例

本文整理匯總了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());
 }
開發者ID:bsa-git,項目名稱:silex-mvc,代碼行數:12,代碼來源:Post.php

示例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());
 }
開發者ID:nickdunn2,項目名稱:nickblog,代碼行數:7,代碼來源:Enquiry.php

示例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']));
 }
開發者ID:romanveliev,項目名稱:forms,代碼行數:7,代碼來源:Users.php

示例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());
 }
開發者ID:skalli350z,項目名稱:project-master,代碼行數:7,代碼來源:AdvertType.php

示例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]));
 }
開發者ID:pdt256,項目名稱:vbscraper,代碼行數:7,代碼來源:Match.php

示例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]));
 }
開發者ID:inklabs,項目名稱:kommerce-core,代碼行數:7,代碼來源:UserRole.php

示例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')));
 }
開發者ID:hrobben,項目名稱:sf2_blog,代碼行數:10,代碼來源:Blog.php

示例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']]));
 }
開發者ID:argentinaluiz,項目名稱:jsdatatables-silex,代碼行數:7,代碼來源:OrderParams.php

示例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());
 }
開發者ID:zyxist,項目名稱:cantiga,代碼行數:7,代碼來源:PasswordRecoveryRequestIntent.php

示例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]));
 }
開發者ID:inklabs,項目名稱:kommerce-core,代碼行數:7,代碼來源:Attribute.php

示例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());
 }
開發者ID:aestene,項目名稱:webpage,代碼行數:7,代碼來源:Department.php

示例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));
 }
開發者ID:robzienert,項目名稱:symfony2bundles,代碼行數:7,代碼來源:Repo.php

示例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)));
 }
開發者ID:xooi,項目名稱:blogTutorial,代碼行數:7,代碼來源:Blog.php

示例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)));
 }
開發者ID:zyxist,項目名稱:cantiga,代碼行數:8,代碼來源:PasswordRecoveryCompleteIntent.php

示例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)));
 }
開發者ID:wilfleaji,項目名稱:portfolio,代碼行數:8,代碼來源:Enquiry.php


注:本文中的Symfony\Component\Validator\Mapping\ClassMetadata::addPropertyConstraint方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。