示例#1
0
 /**
  * This function searches for the given validator $name under propel/validator/$name.php,
  * imports and caches it.
  *
  * @param      string $classname The dot-path name of class (e.g. myapp.propel.MyValidator)
  * @return     Validator object or null if not able to instantiate validator class (and error will be logged in this case)
  */
 public static function getValidator($classname)
 {
     try {
         $v = isset(self::$validatorMap[$classname]) ? self::$validatorMap[$classname] : null;
         if ($v === null) {
             $cls = Propel::importClass($classname);
             $v = new $cls();
             self::$validatorMap[$classname] = $v;
         }
         return $v;
     } catch (Exception $e) {
         Propel::log("BasePeer::getValidator(): failed trying to instantiate " . $classname . ": " . $e->getMessage(), Propel::LOG_ERR);
     }
 }