_fields = $fields; return $this; } /** * * @param string $table * @param string $alias * @return SQL */ public function from($table, $alias) { $this->_from[] = $table . ' AS ' . $alias; return $this; } /** * @param string $condition * @return SQL */ public function where($condition) { $this->_where[] = $condition; return $this; } /** * Gets the query, just an example of building a query, * no check on consistency */ public function getQuery() { return 'SELECT ' . implode(',', $this->_fields) . ' FROM ' . implode(',', $this->_from) . ' WHERE ' . implode(' AND ', $this->_where); } }