Example #1
0
 private function checkAny($val, $op, $coalesce = false)
 {
     if ($this->_field == "any") {
         if (in_array("any.any", $this->_ancestor->_fields)) {
             $f = new Default_Model_FilterItem("any.any", $this->_ancestor);
             $f->{$op}($val, $coalesce);
             $this->_expr = "(" . $f->expr() . ")";
         } else {
             $s = array();
             foreach ($this->_ancestor->_fields as $field) {
                 if (array_key_exists($field, $this->_ancestor->_fieldTypes) && ($this->_ancestor->_fieldTypes[$field] == 'string' || $this->_ancestor->_fieldTypes[$field] == 'string[]' || $field == "id")) {
                     if ($field !== "any.any") {
                         $f = new Default_Model_FilterItem($field, $this->_ancestor);
                         $f->{$op}($val, $coalesce);
                         $s[] = $f->expr();
                     }
                 }
             }
             $this->_expr = "(" . implode($s, " OR ") . ")";
         }
         return true;
     } else {
         return false;
     }
 }
Example #2
0
 public function item($i)
 {
     if (in_array($i, $this->_fields) || $i === "any") {
         $f = new Default_Model_FilterItem($i, $this);
     } else {
         $found = false;
         foreach ($this->_fields as $ii) {
             //debug_log('/^' . $ii . '$/');
             if (preg_match('/^' . $ii . '$/', $i)) {
                 $found = true;
                 $f = new Default_Model_FilterItem($i, $this);
                 break;
             }
         }
         if (!$found) {
             $f = new Default_Model_FilterItem($this->_fields[0], $this);
         }
     }
     $f->setDialect($this->_dialect);
     return $f;
 }