コード例 #1
0
 public function schemaToDbExternalValue($v, EarthIT_Schema_Field $f, EarthIT_Schema_ResourceClass $rc)
 {
     if ($v instanceof EarthIT_DBC_SQLQueryComponent or $v instanceof EarthIT_Storage_InternalValue) {
         throw new Exception("Shouldn't be trying to convert " . get_class($v) . " to DB external value; that conversion should be bypassed.");
     }
     if ($v === null) {
         return null;
     } else {
         if (self::valuesOfTypeShouldBeSelectedAsGeoJson($f->getType()) or self::valuesOfTypeShouldBeSelectedAsJson($f->getType())) {
             return EarthIT_JSON::prettyEncode($v);
         } else {
             return $v;
         }
     }
 }
コード例 #2
0
 public function matches($item)
 {
     if (!array_key_exists($this->referenceName, $item)) {
         throw new Exception(__CLASS__ . '#' . __FUNCTION__ . " can't check item " . "because {$this->referenceName} isn't included on it: " . EarthIT_JSON::prettyEncode($item));
     }
     if ($this->targetIsPlural) {
         $subItems = $item[$this->referenceName];
     } else {
         $subItems = $item[$this->referenceName] === null ? array() : array($item[$this->referenceName]);
     }
     foreach ($subItems as $subItem) {
         if ($this->targetFilter->matches($subItem)) {
             return true;
         }
     }
     return false;
 }