5329c3827c
* Fixed a few layout bugs in new documentation * Fixed documentation table of contents indentation bug in IE6 (fixes #344) * Fixed a parser bug in Sensei_Doc_Section * Restructrured a bit some files of the documentation.
40 lines
977 B
Plaintext
40 lines
977 B
Plaintext
+++ Introduction
|
|
|
|
Database views can greatly increase the performance of complex queries. You can think of them as cached queries. {{Doctrine_View}} provides integration between database views and DQL queries.
|
|
|
|
|
|
+++ Managing views
|
|
|
|
<code type="php">
|
|
$conn = Doctrine_Manager::getInstance()
|
|
->openConnection(new PDO("dsn","username","password"));
|
|
|
|
$query = new Doctrine_Query($conn);
|
|
$query->from('User.Phonenumber')->limit(20);
|
|
|
|
$view = new Doctrine_View($query, 'MyView');
|
|
|
|
// creating a database view
|
|
$view->create();
|
|
|
|
// dropping the view from the database
|
|
$view->drop();
|
|
</code>
|
|
|
|
|
|
+++ Using views
|
|
|
|
<code type="php">
|
|
$conn = Doctrine_Manager::getInstance()
|
|
->openConnection(new PDO("dsn","username","password"));
|
|
|
|
$query = new Doctrine_Query($conn);
|
|
$query->from('User.Phonenumber')->limit(20);
|
|
|
|
// hook the query into appropriate view
|
|
$view = new Doctrine_View($query, 'MyView');
|
|
|
|
// now fetch the data from the view
|
|
$coll = $view->execute();
|
|
</code>
|