public function getQuery($query = null) { static $instance; if ($query instanceof ComMongoDatabaseQueryDocument) { return $query; } if (is_null($instance)) { $instance = new ComMongoDatabaseQueryDocument(); } if (is_array($query)) { foreach ($query as $key => $value) { $instance->where($key, '=', $value); } } return $instance; }
/** * Builds a WHERE clause for the query */ protected function _buildQueryWhere(ComMongoDatabaseQueryDocument $query) { //Get only the unique states $states = $this->_state->getData(true); if (!empty($states)) { $states = $this->getDocument()->mapColumns($states); foreach ($states as $key => $value) { if (is_array($value)) { $query->where($key, 'IN', $value); } else { $query->where($key, '=', $value); } } } }