/** * Add a new compound query. Only select queries can be used with compounds. * * @param string $type * @param \Titon\Db\Query $query * @return $this * @throws \Titon\Db\Exception\InvalidQueryException */ protected function _addCompound($type, Query $query) { if ($query->getType() !== self::SELECT) { throw new InvalidQueryException(sprintf('Only a select query can be used with %s', $type)); } $query->attribute('compound', $type); $this->_compounds[] = $query; return $this; }