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


PHP ValidatorMap類代碼示例

本文整理匯總了PHP中ValidatorMap的典型用法代碼示例。如果您正苦於以下問題:PHP ValidatorMap類的具體用法?PHP ValidatorMap怎麽用?PHP ValidatorMap使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: isValid

 /**
  * @see        BasicValidator::isValid()
  */
 public function isValid(ValidatorMap $map, $value)
 {
     if (is_null($value) == false && is_numeric($value)) {
         return intval($value) >= intval($map->getValue());
     }
     return false;
 }
開發者ID:sensorsix,項目名稱:app,代碼行數:10,代碼來源:MinValueValidator.php

示例2: isValid

 public function isValid(ValidatorMap $map, $str)
 {
     $value = $map->getValue();
     $con = Propel::getConnection(RecipePeer::DATABASE_NAME);
     $sql = "SELECT id FROM " . $value . " WHERE id = :id";
     $stmt = $con->prepare($sql);
     $stmt->execute(array(':id' => $str));
     $result = $stmt->fetchAll();
     return count($result) > 0;
 }
開發者ID:sandrineBeauche,項目名稱:cookbookServer,代碼行數:10,代碼來源:CIRValidator.php

示例3: isValid

 /**
  * @see       BasicValidator::isValid()
  *
  * @param ValidatorMap $map
  * @param string       $str
  *
  * @return boolean
  */
 public function isValid(ValidatorMap $map, $str)
 {
     $column = $map->getColumn();
     $c = new Criteria();
     $c->add($column->getFullyQualifiedName(), $str, Criteria::EQUAL);
     $table = $column->getTable()->getClassName();
     $clazz = $table . 'Peer';
     $count = call_user_func(array($clazz, 'doCount'), $c);
     $isValid = $count === 0;
     return $isValid;
 }
開發者ID:kcornejo,項目名稱:estadistica,代碼行數:19,代碼來源:UniqueValidator.php

示例4: isValid

 /**
  * @see BasicValidator::isValid()
  */
 public function isValid(ValidatorMap $map, $str)
 {
     $column = $map->getColumn();
     $c = new Criteria();
     $c->add($column->getFullyQualifiedName(), $str, Criteria::EQUAL);
     $isValid = false;
     try {
         $table = $column->getTable()->getPhpName();
         $cmd = sprintf('$isValid = %sPeer::doCount($c) == 0;', $table);
         eval($cmd);
     } catch (PropelException $e) {
         /* what to do here ? */
     }
     return $isValid;
 }
開發者ID:EfncoPlugins,項目名稱:Media-Management-based-on-Kaltura,代碼行數:18,代碼來源:UniqueValidator.php

示例5: isValid

 /**
  * @see       BasicValidator::isValid()
  *
  * @param     ValidatorMap  $map
  * @param     mixed         $value
  *
  * @return    boolean
  */
 public function isValid(ValidatorMap $map, $value)
 {
     switch ($map->getValue()) {
         case 'array':
             return is_array($value);
             break;
         case 'bool':
         case 'boolean':
             return is_bool($value);
             break;
         case 'float':
             return is_float($value);
             break;
         case 'int':
         case 'integer':
             return is_int($value);
             break;
         case 'numeric':
             return is_numeric($value);
             break;
         case 'object':
             return is_object($value);
             break;
         case 'resource':
             return is_resource($value);
             break;
         case 'scalar':
             return is_scalar($value);
             break;
         case 'string':
             return is_string($value);
             break;
         case 'function':
             return function_exists($value);
             break;
         default:
             throw new PropelException('Unkonwn type ' . $map->getValue());
             break;
     }
 }
開發者ID:ketheriel,項目名稱:ETVA,代碼行數:48,代碼來源:TypeValidator.php

示例6: isValid

 /**
  * @see BasicValidator::isValid()
  */
 public function isValid(ValidatorMap $map, $str)
 {
     return strlen($str) >= intval($map->getValue());
 }
開發者ID:rodrigoprestesmachado,項目名稱:whiteboard,代碼行數:7,代碼來源:MinLengthValidator.php

示例7: addValidator

  /**
  * Add a validator to a table's column
  *
  * @param      string $columnName The name of the validator's column
  * @param      string $name The rule name of this validator
  * @param      string $classname The dot-path name of class to use (e.g. myapp.propel.MyValidator)
  * @param      string $value
  * @param      string $message The error message which is returned on invalid values
  * @return     void
  */
  public function addValidator($columnName, $name, $classname, $value, $message)
  {
    if (false !== ($pos = strpos($columnName, '.'))) {
      $columnName = substr($columnName, $pos + 1);
    }

    $col = $this->getColumn($columnName);
    if ($col !== null) {
      $validator = new ValidatorMap($col);
      $validator->setName($name);
      $validator->setClass($classname);
      $validator->setValue($value);
      $validator->setMessage($message);
      $col->addValidator($validator);
    }
  }
開發者ID:rhertzog,項目名稱:lcs,代碼行數:26,代碼來源:TableMap.php

示例8: isValid

 public function isValid(ValidatorMap $map, $value)
 {
     return gettype($value) == $map->getValue();
 }
開發者ID:nhemsley,項目名稱:propel,代碼行數:4,代碼來源:TypeValidator.php

示例9: isValid

 public function isValid(ValidatorMap $map, $str)
 {
     return in_array($str, explode("|", $map->getValue()));
 }
開發者ID:taryono,項目名稱:school,代碼行數:4,代碼來源:ValidValuesValidator.php

示例10: isValid

 /**
  * Whether the passed string matches regular expression.
  */
 public function isValid(ValidatorMap $map, $str)
 {
     return preg_match($this->prepareRegexp($map->getValue()), $str) != 0;
 }
開發者ID:nextbigsound,項目名稱:propel-orm,代碼行數:7,代碼來源:MatchValidator.php

示例11: isValid

 /**
  * @see       BasicValidator::isValid()
  *
  * @param     ValidatorMap  $map
  * @param     string        $str
  *
  * @return    boolean
  */
 public function isValid(ValidatorMap $map, $str)
 {
     $len = function_exists('mb_strlen') ? mb_strlen($str) : strlen($str);
     return $len >= intval($map->getValue());
 }
開發者ID:ketheriel,項目名稱:ETVA,代碼行數:13,代碼來源:MinLengthValidator.php

示例12: isValid

 /**
  * @see       BasicValidator::isValid()
  *
  * @param ValidatorMap $map
  * @param string       $str
  *
  * @return boolean
  */
 public function isValid(ValidatorMap $map, $str)
 {
     return in_array($str, preg_split("/[|,]/", $map->getValue()));
 }
開發者ID:kcornejo,項目名稱:estadistica,代碼行數:12,代碼來源:ValidValuesValidator.php


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