Basic Components - Collection - Introduction.php 405 Bytes
Newer Older
1
<?php
2 3
$conn = Doctrine_Manager::getInstance()
    ->openConnection(new PDO("dsn", "username", "pw"));
4

5 6 7 8 9 10 11
// initalizing a new collection
$users = new Doctrine_Collection($conn->getTable('User'));

// alternative (propably easier)
$users = new Doctrine_Collection('User');

// adding some data
12 13 14 15
$coll[0]->name = 'Arnold';

$coll[1]->name = 'Somebody';

16
// finally save it!
17 18
$coll->save();
?>