src/Components/Schema.php
public function createView($table, $columns, $select, $options = null)
    {
        $sql = "CREATE VIEW " . $this->quoteTableName($table);
        if (!empty($columns)) {
            if (is_array($columns)) {
                foreach ($columns as &$name) {
                    $name = $this->quoteColumnName($name);
                }
                $columns = implode(',', $columns);
            }
            $sql .= " ($columns)";
        }
        $sql .= " AS " . $select;

        return $sql;
    }
public function createView($table, $columns, $select, $options = null)
    {
        $sql = "CREATE VIEW " . $this->quoteTableName($table);
        if (!empty($columns)) {
            if (is_array($columns)) {
                foreach ($columns as &$name) {
                    $name = $this->quoteColumnName($name);
                }
                $columns = implode(',', $columns);
            }
            $sql .= " ($columns)";
        }
        $sql .= " AS " . $select;

        return $sql;
    }
Builds a SQL statement for creating a new DB view of an existing table.


@param string $table   the name of the view to be created. The name will be properly quoted by the method.
@param array  $columns optional mapping to the columns in the select of the new view.
@param string $select  SQL statement defining the view.
@param string $options additional SQL fragment that will be appended to the generated SQL.

@return string the SQL statement for creating a new DB table.