public function fromSelect(Gpf_SqlBuilder_SelectBuilder $selectBuilder) { $this->fromSelect = $selectBuilder->toString(); foreach ($selectBuilder->select->getColumns() as $column) { if ($this->table !== null && !$this->table->hasColumn($column->getAlias())) { throw new Gpf_Exception('Column ' . $column->getAlias() . " doesn't exist in {$this->tableName}."); } $i = count($this->columns); $this->columns[$i]['column'] = $column->getAlias(); } }