Ejemplo n.º 1
0
 /**
  * Returns the "casting helper" for the given field and the casting class name.  A casting helper 
  * is a piece of PHP code that, when evaluated, will create an object to represent the value.
  * 
  * The return value is an map containing two values:
  *  - className: The name of the class (eg: 'Varchar')
  *  - castingHelper: The casting helper (eg: 'return new Varchar($fieldName);')
  * 
  * @param string $field The field name
  * @return array
  */
 public function castingHelperPair($field)
 {
     $class = $this->class;
     if (!isset(self::$castingHelperPair_cache[$class])) {
         if ($this->failover) {
             $this->failover->buildCastingHelperCache(self::$castingHelperPair_cache[$class]);
         }
         $this->buildCastingHelperCache(self::$castingHelperPair_cache[$class]);
         self::$castingHelperPair_cache[$class]['ClassName'] = array("className" => "Varchar", "castingHelper" => "return new Varchar(\$fieldName);");
     }
     return isset(self::$castingHelperPair_cache[$class][$field]) ? self::$castingHelperPair_cache[$class][$field] : null;
 }