当前位置: 首页>>代码示例>>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;未经允许,请勿转载。