toArray() public method

public toArray ( )
Example #1
0
 /**
  * Used to get hash that uniquely identifies current query
  */
 public function getHash()
 {
     $hash = array();
     // expression
     $hash[] = json_encode($this->expression->toArray());
     // sorts
     if ($this->sort) {
         $sort = $this->sort;
         ksort($sort);
         $hash[] = implode('', array_merge(array_keys($sort), array_values($sort)));
     }
     // fields
     if ($this->fields) {
         $fields = $this->fields;
         ksort($fields);
         $hash[] = implode('', array_merge(array_keys($fields), array_values($fields)));
     }
     // skip and limit
     $hash[] = $this->skip;
     $hash[] = $this->limit;
     // get hash
     return md5(implode(':', $hash));
 }
Example #2
0
 public function merge(Expression $expression)
 {
     $this->_expression = array_merge_recursive($this->_expression, $expression->toArray());
     return $this;
 }