Doctrine 1.2.4
Doctrine_View Class Reference

Public Member Functions

 __construct (Doctrine_Query $query, $viewName)
 
 create ()
 
 drop ()
 
 execute ()
 
 getConnection ()
 
 getName ()
 
 getQuery ()
 
 getSelectSql ()
 
 getViewDql ()
 
 getViewSql ()
 

Data Fields

const CREATE = 'CREATE VIEW %s AS %s'
 
const DROP = 'DROP VIEW %s'
 
const SELECT = 'SELECT * FROM %s'
 

Detailed Description

Definition at line 35 of file View.php.

Constructor & Destructor Documentation

Doctrine_View::__construct ( Doctrine_Query  $query,
  $viewName 
)

constructor

Parameters
Doctrine_Query$query

Definition at line 82 of file View.php.

{
$this->_name = $viewName;
$this->_query = $query;
$this->_query->setView($this);
$this->_conn = $query->getConnection();
$this->_dql = $query->getDql();
$this->_sql = $query->getSqlQuery();
}

Member Function Documentation

Doctrine_View::create ( )

creates this view

Exceptions
Doctrine_View_Exception
Returns
void

Definition at line 128 of file View.php.

{
$sql = sprintf(self::CREATE, $this->_name, $this->_query->getSqlQuery());
try {
$this->_conn->execute($sql, $this->_query->getFlattenedParams());
} catch(Doctrine_Exception $e) {
throw new Doctrine_View_Exception($e->__toString());
}
}
Doctrine_View::drop ( )

drops this view from the database

Exceptions
Doctrine_View_Exception
Returns
void

Definition at line 144 of file View.php.

{
try {
$this->_conn->execute(sprintf(self::DROP, $this->_name));
} catch(Doctrine_Exception $e) {
throw new Doctrine_View_Exception($e->__toString());
}
}
Doctrine_View::execute ( )

returns a collection of Doctrine_Record objects

Returns
Doctrine_Collection

Definition at line 158 of file View.php.

{
return $this->_query->execute();
}
Doctrine_View::getConnection ( )

returns the connection object

Returns
Doctrine_Connection

Definition at line 117 of file View.php.

{
return $this->_conn;
}
Doctrine_View::getName ( )

returns the name of this view

Returns
string

Definition at line 107 of file View.php.

{
return $this->_name;
}
Doctrine_View::getQuery ( )

returns the associated query object

Returns
Doctrine_Query

Definition at line 97 of file View.php.

{
return $this->_query;
}
Doctrine_View::getSelectSql ( )

returns the select sql for this view

Returns
string

Definition at line 168 of file View.php.

{
return sprintf(self::SELECT, $this->_name);
}
Doctrine_View::getViewDql ( )

Get the view dql string

Returns
string $dql

Definition at line 188 of file View.php.

{
return $this->_dql;
}
Doctrine_View::getViewSql ( )

Get the view sql string

Returns
string $sql

Definition at line 178 of file View.php.

{
return $this->_sql;
}

Field Documentation

const Doctrine_View::CREATE = 'CREATE VIEW %s AS %s'

SQL CREATE constant

Definition at line 45 of file View.php.

const Doctrine_View::DROP = 'DROP VIEW %s'

SQL DROP constant

Definition at line 40 of file View.php.

const Doctrine_View::SELECT = 'SELECT * FROM %s'

SQL SELECT constant

Definition at line 50 of file View.php.


The documentation for this class was generated from the following file: