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