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


PHP InputFilter::setValidationGroup方法代碼示例

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


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

示例1: setValidationGroup

 /**
  * Override to implicitly ignore unkown fields
  * This allow for user to submit extra fields
  * @param mixed $name
  * @return mixed
  */
 public function setValidationGroup($name)
 {
     if (is_array($name)) {
         $known = array_keys($this->getInputs());
         $name = array_intersect($name, $known);
     }
     return parent::setValidationGroup($name);
 }
開發者ID:Theodia,項目名稱:theodia.org,代碼行數:14,代碼來源:InputFilter.php

示例2: setInputsToFilter

 /**
  * Set inputs (by name) to filter/validate.
  *
  * null = filter all
  * empty array = filter none
  *
  * @param array|null $inputs
  * @return BaseFilter
  */
 public function setInputsToFilter($inputs)
 {
     // No need to apply validation groups for empty arrays
     if (!is_array($inputs) || $this->needsFiltering($inputs)) {
         try {
             if ($inputs === null) {
                 // Provide Zend's expected value when intending to filter all inputs...
                 $group = self::VALIDATE_ALL;
             } elseif (is_array($inputs)) {
                 $knownInputs = array_keys($this->getInputs());
                 $group = array_intersect($inputs, $knownInputs);
             } else {
                 $group = $inputs;
             }
             parent::setValidationGroup($group);
         } catch (InputFilterException $e) {
             throw new Exception\InvalidArgumentException(sprintf('Failed to set inputs to filter: %s', $e->getMessage()), 0, $e);
         }
     }
     // Apply only after we made sure the provided inputs are valid
     $this->inputsToFilter = $inputs;
     return $this;
 }
開發者ID:detailnet,項目名稱:dfw-filtering,代碼行數:32,代碼來源:BaseFilter.php

示例3: setValidationGroup

 /**
  * {@inheritdoc}
  */
 public function setValidationGroup($name)
 {
     if ($name === self::VALIDATE_ALL) {
         $this->validationGroup = null;
         return $this;
     }
     if (is_array($name)) {
         // Best effort check if the validation group was set by a form for BC
         if (count($name) == count($this->collectionData) && is_array(reset($name))) {
             return parent::setValidationGroup(reset($name));
         }
         return parent::setValidationGroup($name);
     }
     return parent::setValidationGroup(func_get_args());
 }
開發者ID:idwsdta,項目名稱:INIT-frame,代碼行數:18,代碼來源:CollectionInputFilter.php


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