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


PHP ExecutionContextInterface::setGroup方法代碼示例

本文整理匯總了PHP中Symfony\Component\Validator\Context\ExecutionContextInterface::setGroup方法的典型用法代碼示例。如果您正苦於以下問題:PHP ExecutionContextInterface::setGroup方法的具體用法?PHP ExecutionContextInterface::setGroup怎麽用?PHP ExecutionContextInterface::setGroup使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Symfony\Component\Validator\Context\ExecutionContextInterface的用法示例。


在下文中一共展示了ExecutionContextInterface::setGroup方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: setGroup

 protected function setGroup($group)
 {
     $this->group = $group;
     switch ($this->getApiVersion()) {
         case Validation::API_VERSION_2_4:
             $this->context = $this->createContext();
             $this->validator->initialize($this->context);
             break;
         case Validation::API_VERSION_2_5:
         case Validation::API_VERSION_2_5_BC:
             $this->context->setGroup($group);
             break;
     }
 }
開發者ID:alexbogo,項目名稱:symfony,代碼行數:14,代碼來源:AbstractConstraintValidatorTest.php

示例2: validateInGroup

 /**
  * Validates a node's value against all constraints in the given group.
  *
  * @param mixed                     $value      The validated value
  * @param string                    $cacheKey   The key for caching the
  *                                              validated value
  * @param MetadataInterface         $metadata   The metadata of the value
  * @param string                    $group      The group to validate
  * @param ExecutionContextInterface $context    The execution context
  */
 private function validateInGroup($value, $cacheKey, MetadataInterface $metadata, $group, ExecutionContextInterface $context)
 {
     $context->setGroup($group);
     foreach ($metadata->findConstraints($group) as $constraint) {
         // Prevent duplicate validation of constraints, in the case
         // that constraints belong to multiple validated groups
         if (null !== $cacheKey) {
             $constraintHash = spl_object_hash($constraint);
             if ($context->isConstraintValidated($cacheKey, $constraintHash)) {
                 continue;
             }
             $context->markConstraintAsValidated($cacheKey, $constraintHash);
         }
         $context->setConstraint($constraint);
         $validator = $this->validatorFactory->getInstance($constraint);
         $validator->initialize($context);
         $validator->validate($value, $constraint);
     }
 }
開發者ID:brennantom,項目名稱:hackazon,代碼行數:29,代碼來源:RecursiveContextualValidator.php

示例3: setGroup

 protected function setGroup($group)
 {
     $this->group = $group;
     $this->context->setGroup($group);
 }
開發者ID:ABaldwinHunter,項目名稱:symfony-clone,代碼行數:5,代碼來源:AbstractConstraintValidatorTest.php


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