src/db/Migration.php
public function createView ($name, Query $query, $replace = true)
		{
			echo "    > create table $name ...";
			$time = microtime(true);

			$sql = 'CREATE' . ( $replace ? ' OR REPLACE' : '' ) . ' VIEW ' . $this->db->quoteTableName($name) . ' AS ' . $query->createCommand()->getRawSql();
			$this->db->createCommand($sql)->execute();

			echo '    > done (time: ' . sprintf('%.3f', microtime(true) - $time) . "s)\n";
		}
public function createView ($name, Query $query, $replace = true)
		{
			echo "    > create table $name ...";
			$time = microtime(true);

			$sql = 'CREATE' . ( $replace ? ' OR REPLACE' : '' ) . ' VIEW ' . $this->db->quoteTableName($name) . ' AS ' . $query->createCommand()->getRawSql();
			$this->db->createCommand($sql)->execute();

			echo '    > done (time: ' . sprintf('%.3f', microtime(true) - $time) . "s)\n";
		}
public function createView ( $ name , Query $ query , $ replace = true ) { echo "    > create table $name ..." ; $ time = microtime ( true ) ; $ sql = 'CREATE' . ( $ replace ? ' OR REPLACE' : '' ) . ' VIEW ' . $ this -> db -> quoteTableName ( $ name ) . ' AS ' . $ query -> createCommand ( ) -> getRawSql ( ) ; $ this -> db -> createCommand ( $ sql ) -> execute ( ) ; echo '    > done (time: ' . sprintf ( '%.3f' , microtime ( true ) - $ time ) . "s)\n" ; }
Creates database view.

@param string $name View name.
@param Query  $query Query that is used to create view.
@param bool   $replace Whether to replace existing view with the same name.

@throws \yii\db\Exception
@see dropView
Creates database view .