Commit 3b8b1a4e authored by zYne's avatar zYne

Added connection & collection introductions + first code examples for Doctrine_View

parent 77a69bc5
<?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();
?>
<?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();
?>
<?php
$coll = new Doctrine_Collection('User');
$conn = Doctrine_Manager::getInstance()
->openConnection(new PDO("dsn", "username", "pw"));
// initalizing a new collection
$users = new Doctrine_Collection($conn->getTable('User'));
// alternative (propably easier)
$users = new Doctrine_Collection('User');
// adding some data
$coll[0]->name = 'Arnold';
$coll[1]->name = 'Somebody';
// finally save it!
$coll->save();
?>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment