/** * @param KDatabaseQuery $query */ protected function _buildQueryHaving(KDatabaseQuery $query) { // If we have a parent id level is set using the where clause if (!$this->_state->parent_id && $this->_state->level !== null) { // Query object does not support operators in having clauses // So we need to build the string ourselves $query->having('level IN (' . implode(',', (array) $this->_state->level) . ')'); } parent::_buildQueryHaving($query); }