From 16e4296626f3ae273455269c9f2512f60b618e21 Mon Sep 17 00:00:00 2001
From: hansbrix
";
- foreach($user->Phonenumber as $phonenumber) {
- print $phonenumber."
";
- }
-}
-
-// same thing implemented much more efficiently:
-// (using only one sql query for object population)
-
-$users = $conn->query("FROM User.Phonenumber");
-
-foreach($users as $user) {
- print $user->name."
";
- foreach($user->Phonenumber as $phonenumber) {
- print $phonenumber."
";
- }
-}
-
-?>
diff --git a/manual/codes/DQL (Doctrine Query Language) - LIMIT and OFFSET clauses - Driver portability.php b/manual/codes/DQL (Doctrine Query Language) - LIMIT and OFFSET clauses - Driver portability.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/DQL (Doctrine Query Language) - LIMIT and OFFSET clauses - Introduction.php b/manual/codes/DQL (Doctrine Query Language) - LIMIT and OFFSET clauses - Introduction.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/DQL (Doctrine Query Language) - LIMIT and OFFSET clauses - The limit-subquery-algorithm.php b/manual/codes/DQL (Doctrine Query Language) - LIMIT and OFFSET clauses - The limit-subquery-algorithm.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/DQL (Doctrine Query Language) - LIMIT and OFFSET clauses.php b/manual/codes/DQL (Doctrine Query Language) - LIMIT and OFFSET clauses.php
deleted file mode 100644
index b9dc2e986..000000000
--- a/manual/codes/DQL (Doctrine Query Language) - LIMIT and OFFSET clauses.php
+++ /dev/null
@@ -1,14 +0,0 @@
-query("SELECT u.*, p.* FROM User u, u.Phonenumber p LIMIT 20");
-
-foreach($users as $user) {
- print ' --- '.$user->name.' --- \n';
-
- foreach($user->Phonenumber as $p) {
- print $p->phonenumber.'\n';
- }
-}
-?>
diff --git a/manual/codes/DQL (Doctrine Query Language) - LIMIT and OFFSET.php b/manual/codes/DQL (Doctrine Query Language) - LIMIT and OFFSET.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/DQL (Doctrine Query Language) - ORDER BY clause.php b/manual/codes/DQL (Doctrine Query Language) - ORDER BY clause.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/DQL (Doctrine Query Language) - ORDER BY.php b/manual/codes/DQL (Doctrine Query Language) - ORDER BY.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/DQL (Doctrine Query Language) - Operators - Logical operators.php b/manual/codes/DQL (Doctrine Query Language) - Operators - Logical operators.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/DQL (Doctrine Query Language) - SELECT queries - Aggregate values.php b/manual/codes/DQL (Doctrine Query Language) - SELECT queries - Aggregate values.php
deleted file mode 100644
index 052101363..000000000
--- a/manual/codes/DQL (Doctrine Query Language) - SELECT queries - Aggregate values.php
+++ /dev/null
@@ -1,14 +0,0 @@
-select('u.*, COUNT(p.id) num_posts')
- ->from('User u, u.Posts p')
- ->where('u.id = ?', 1)
- ->groupby('u.id');
-
-$users = $query->execute();
-
-echo $users->Posts[0]->num_posts . ' posts found';
-?>
diff --git a/manual/codes/DQL (Doctrine Query Language) - SELECT queries.php b/manual/codes/DQL (Doctrine Query Language) - SELECT queries.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/DQL (Doctrine Query Language) - UPDATE queries.php b/manual/codes/DQL (Doctrine Query Language) - UPDATE queries.php
deleted file mode 100644
index 0deaeff90..000000000
--- a/manual/codes/DQL (Doctrine Query Language) - UPDATE queries.php
+++ /dev/null
@@ -1,16 +0,0 @@
- 200';
-
-$rows = $this->conn->query($q);
-
-// the same query using the query interface
-
-$q = new Doctrine_Query();
-
-$rows = $q->update('Account')
- ->set('amount', 'amount + 200')
- ->where('id > 200')
- ->execute();
-
-print $rows; // the number of affected rows
-?>
diff --git a/manual/codes/DQL (Doctrine Query Language) - WHERE clause.php b/manual/codes/DQL (Doctrine Query Language) - WHERE clause.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/Drivers - Mysql - Tips and tricks.php b/manual/codes/Drivers - Mysql - Tips and tricks.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/Drivers - Oracle - Making unsuported functions work.php b/manual/codes/Drivers - Oracle - Making unsuported functions work.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/Functions - Contains.php b/manual/codes/Functions - Contains.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/Functions - Like.php b/manual/codes/Functions - Like.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/Functions - Regexp.php b/manual/codes/Functions - Regexp.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/Getting started - Compiling.php b/manual/codes/Getting started - Compiling.php
deleted file mode 100644
index 4e25e99ec..000000000
--- a/manual/codes/Getting started - Compiling.php
+++ /dev/null
@@ -1,7 +0,0 @@
-
diff --git a/manual/codes/Getting started - Data types - Array.php b/manual/codes/Getting started - Data types - Array.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/Getting started - Data types - Blob.php b/manual/codes/Getting started - Data types - Blob.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/Getting started - Data types - Boolean.php b/manual/codes/Getting started - Data types - Boolean.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/Getting started - Data types - Clob.php b/manual/codes/Getting started - Data types - Clob.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/Getting started - Data types - Date.php b/manual/codes/Getting started - Data types - Date.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/Getting started - Data types - Enum.php b/manual/codes/Getting started - Data types - Enum.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/Getting started - Data types - Float.php b/manual/codes/Getting started - Data types - Float.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/Getting started - Data types - Gzip.php b/manual/codes/Getting started - Data types - Gzip.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/Getting started - Data types - Integer.php b/manual/codes/Getting started - Data types - Integer.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/Getting started - Data types - Object.php b/manual/codes/Getting started - Data types - Object.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/Getting started - Data types - String.php b/manual/codes/Getting started - Data types - String.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/Getting started - Data types - Timestamp.php b/manual/codes/Getting started - Data types - Timestamp.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/Getting started - Requirements.php b/manual/codes/Getting started - Requirements.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/Getting started - Setting table definition - Constraints and validators.php b/manual/codes/Getting started - Setting table definition - Constraints and validators.php
deleted file mode 100644
index 77e8b11b8..000000000
--- a/manual/codes/Getting started - Setting table definition - Constraints and validators.php
+++ /dev/null
@@ -1,15 +0,0 @@
-hasColumn("name", "string", 50, array("nospace" => true));
-
- // the email should be a valid email
- $this->hasColumn("email", "string", 200, array("email" => true));
-
- // home_country should be a valid country code and not null
- $this->hasColumn("home_country", "string", 2, array("country" => true, "notnull" => true));
-
- }
-}
-?>
diff --git a/manual/codes/Getting started - Setting table definition - Data types and lengths.php b/manual/codes/Getting started - Setting table definition - Data types and lengths.php
deleted file mode 100644
index 89fbc5267..000000000
--- a/manual/codes/Getting started - Setting table definition - Data types and lengths.php
+++ /dev/null
@@ -1,27 +0,0 @@
-hasColumn("title","string",100);
-
- // maps into TEXT on mysql
- $this->hasColumn("content","string",4000);
-
- // maps into TINYINT on mysql
- $this->hasColumn("type","integer",1);
-
- // maps into INT on mysql
- $this->hasColumn("type2","integer",11);
-
- // maps into BIGINT on mysql
- $this->hasColumn("type3","integer",20);
-
- // maps into TEXT on mysql
- // (serialized and unserialized automatically by doctrine)
- $this->hasColumn("types","array",4000);
-
- }
-}
-?>
diff --git a/manual/codes/Getting started - Setting table definition - Default values.php b/manual/codes/Getting started - Setting table definition - Default values.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/Getting started - Setting table definition - Enum emulation.php b/manual/codes/Getting started - Setting table definition - Enum emulation.php
deleted file mode 100644
index 98bf3d838..000000000
--- a/manual/codes/Getting started - Setting table definition - Enum emulation.php
+++ /dev/null
@@ -1,19 +0,0 @@
-hasColumn("title","string", 200);
-
- // maps to TINYINT on mysql
- $this->hasColumn("section", "enum", 2, array('values' => array("PHP","Python","Java","Ruby")));
- }
-}
-$article = new Article;
-$article->title = 'My first php article';
-// doctrine auto-converts the section to integer when the
-// record is being saved
-$article->section = 'PHP';
-$article->save();
-
-// on insert query with values 'My first php article' and 0
-// would be issued
-?>
diff --git a/manual/codes/Getting started - Setting table definition - Table options.php b/manual/codes/Getting started - Setting table definition - Table options.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/Hierarchical data - Adjacency list - Introduction.php b/manual/codes/Hierarchical data - Adjacency list - Introduction.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/Hierarchical data - Introduction.php b/manual/codes/Hierarchical data - Introduction.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/Hierarchical data - Materialized path - Introduction.php b/manual/codes/Hierarchical data - Materialized path - Introduction.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/Hierarchical data - Nested set - Introduction.php b/manual/codes/Hierarchical data - Nested set - Introduction.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/Hierarchical data - NestedSet - Introduction.php b/manual/codes/Hierarchical data - NestedSet - Introduction.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/Native SQL - Component queries.php b/manual/codes/Native SQL - Component queries.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/Native SQL - Fetching multiple components.php b/manual/codes/Native SQL - Fetching multiple components.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/Native SQL - Scalar queries.php b/manual/codes/Native SQL - Scalar queries.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/Object relational mapping - Columns - Column aliases.php b/manual/codes/Object relational mapping - Columns - Column aliases.php
deleted file mode 100644
index 0ced54cc6..000000000
--- a/manual/codes/Object relational mapping - Columns - Column aliases.php
+++ /dev/null
@@ -1,12 +0,0 @@
-hasColumn('bookName as name', 'string');
- }
-}
-$book = new Book();
-$book->name = 'Some book';
-$book->save();
-?>
diff --git a/manual/codes/Object relational mapping - Columns - Column naming.php b/manual/codes/Object relational mapping - Columns - Column naming.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/Object relational mapping - Columns - Data types - Array.php b/manual/codes/Object relational mapping - Columns - Data types - Array.php
deleted file mode 100644
index f6446c774..000000000
--- a/manual/codes/Object relational mapping - Columns - Data types - Array.php
+++ /dev/null
@@ -1,7 +0,0 @@
-hasColumn('arraytest', 'array', 10000);
- }
-}
-?>
diff --git a/manual/codes/Object relational mapping - Columns - Data types - Blob.php b/manual/codes/Object relational mapping - Columns - Data types - Blob.php
deleted file mode 100644
index c20257a73..000000000
--- a/manual/codes/Object relational mapping - Columns - Data types - Blob.php
+++ /dev/null
@@ -1,7 +0,0 @@
-hasColumn('blobtest', 'blob');
- }
-}
-?>
diff --git a/manual/codes/Object relational mapping - Columns - Data types - Boolean.php b/manual/codes/Object relational mapping - Columns - Data types - Boolean.php
deleted file mode 100644
index 1f0ab9cd2..000000000
--- a/manual/codes/Object relational mapping - Columns - Data types - Boolean.php
+++ /dev/null
@@ -1,7 +0,0 @@
-hasColumn('booltest', 'boolean');
- }
-}
-?>
diff --git a/manual/codes/Object relational mapping - Columns - Data types - Clob.php b/manual/codes/Object relational mapping - Columns - Data types - Clob.php
deleted file mode 100644
index d25420d08..000000000
--- a/manual/codes/Object relational mapping - Columns - Data types - Clob.php
+++ /dev/null
@@ -1,7 +0,0 @@
-hasColumn('clobtest', 'clob');
- }
-}
-?>
diff --git a/manual/codes/Object relational mapping - Columns - Data types - Date.php b/manual/codes/Object relational mapping - Columns - Data types - Date.php
deleted file mode 100644
index 50bcca1e4..000000000
--- a/manual/codes/Object relational mapping - Columns - Data types - Date.php
+++ /dev/null
@@ -1,7 +0,0 @@
-hasColumn('datetest', 'date');
- }
-}
-?>
diff --git a/manual/codes/Object relational mapping - Columns - Data types - Enum.php b/manual/codes/Object relational mapping - Columns - Data types - Enum.php
deleted file mode 100644
index 384a50dee..000000000
--- a/manual/codes/Object relational mapping - Columns - Data types - Enum.php
+++ /dev/null
@@ -1,15 +0,0 @@
-hasColumn('enumtest', 'enum', 4,
- array(
- 'values' => array(
- 'php',
- 'java',
- 'python'
- )
- )
- );
- }
-}
-?>
diff --git a/manual/codes/Object relational mapping - Columns - Data types - Float.php b/manual/codes/Object relational mapping - Columns - Data types - Float.php
deleted file mode 100644
index bd12c57a1..000000000
--- a/manual/codes/Object relational mapping - Columns - Data types - Float.php
+++ /dev/null
@@ -1,7 +0,0 @@
-hasColumn('floattest', 'float');
- }
-}
-?>
diff --git a/manual/codes/Object relational mapping - Columns - Data types - Gzip.php b/manual/codes/Object relational mapping - Columns - Data types - Gzip.php
deleted file mode 100644
index aaf1a0a17..000000000
--- a/manual/codes/Object relational mapping - Columns - Data types - Gzip.php
+++ /dev/null
@@ -1,7 +0,0 @@
-hasColumn('gziptest', 'gzip');
- }
-}
-?>
diff --git a/manual/codes/Object relational mapping - Columns - Data types - Integer.php b/manual/codes/Object relational mapping - Columns - Data types - Integer.php
deleted file mode 100644
index 1fcf5aa97..000000000
--- a/manual/codes/Object relational mapping - Columns - Data types - Integer.php
+++ /dev/null
@@ -1,7 +0,0 @@
-hasColumn('integertest', 'integer', 4, array('unsigned' => true));
- }
-}
-?>
diff --git a/manual/codes/Object relational mapping - Columns - Data types - Introduction.php b/manual/codes/Object relational mapping - Columns - Data types - Introduction.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/Object relational mapping - Columns - Data types - Object.php b/manual/codes/Object relational mapping - Columns - Data types - Object.php
deleted file mode 100644
index 641815133..000000000
--- a/manual/codes/Object relational mapping - Columns - Data types - Object.php
+++ /dev/null
@@ -1,7 +0,0 @@
-hasColumn('objecttest', 'object');
- }
-}
-?>
diff --git a/manual/codes/Object relational mapping - Columns - Data types - String.php b/manual/codes/Object relational mapping - Columns - Data types - String.php
deleted file mode 100644
index 5e53f6a06..000000000
--- a/manual/codes/Object relational mapping - Columns - Data types - String.php
+++ /dev/null
@@ -1,7 +0,0 @@
-hasColumn('stringtest', 'string', 200, array('fixed' => true));
- }
-}
-?>
diff --git a/manual/codes/Object relational mapping - Columns - Data types - Time.php b/manual/codes/Object relational mapping - Columns - Data types - Time.php
deleted file mode 100644
index fc69af27a..000000000
--- a/manual/codes/Object relational mapping - Columns - Data types - Time.php
+++ /dev/null
@@ -1,7 +0,0 @@
-hasColumn('timetest', 'time');
- }
-}
-?>
diff --git a/manual/codes/Object relational mapping - Columns - Data types - Timestamp.php b/manual/codes/Object relational mapping - Columns - Data types - Timestamp.php
deleted file mode 100644
index bd069ab91..000000000
--- a/manual/codes/Object relational mapping - Columns - Data types - Timestamp.php
+++ /dev/null
@@ -1,7 +0,0 @@
-hasColumn('timestamptest', 'timestamp');
- }
-}
-?>
diff --git a/manual/codes/Object relational mapping - Columns - Data types - Type modifiers.php b/manual/codes/Object relational mapping - Columns - Data types - Type modifiers.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/Object relational mapping - Record identifiers - Autoincremented.php b/manual/codes/Object relational mapping - Record identifiers - Autoincremented.php
deleted file mode 100644
index d1c007033..000000000
--- a/manual/codes/Object relational mapping - Record identifiers - Autoincremented.php
+++ /dev/null
@@ -1,8 +0,0 @@
-hasColumn('uid','integer',20,'primary|autoincrement');
-
- }
-}
-?>
diff --git a/manual/codes/Object relational mapping - Record identifiers - Composite.php b/manual/codes/Object relational mapping - Record identifiers - Composite.php
deleted file mode 100644
index db653bfd5..000000000
--- a/manual/codes/Object relational mapping - Record identifiers - Composite.php
+++ /dev/null
@@ -1,8 +0,0 @@
-hasColumn('user_id', 'integer', 20, 'primary');
- $this->hasColumn('group_id', 'integer', 20, 'primary');
- }
-}
-?>
diff --git a/manual/codes/Object relational mapping - Record identifiers - Introduction.php b/manual/codes/Object relational mapping - Record identifiers - Introduction.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/Object relational mapping - Record identifiers - Natural.php b/manual/codes/Object relational mapping - Record identifiers - Natural.php
deleted file mode 100644
index 2eaccf222..000000000
--- a/manual/codes/Object relational mapping - Record identifiers - Natural.php
+++ /dev/null
@@ -1,7 +0,0 @@
-hasColumn('name','string',200,'primary');
- }
-}
-?>
diff --git a/manual/codes/Object relational mapping - Record identifiers - Sequence.php b/manual/codes/Object relational mapping - Record identifiers - Sequence.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/Object relational mapping - Record identifiers - Sequential.php b/manual/codes/Object relational mapping - Record identifiers - Sequential.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/Object relational mapping - Relations - Composites and aggregates.php b/manual/codes/Object relational mapping - Relations - Composites and aggregates.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/Object relational mapping - Relations - Foreign key associations - One-to-Many, Many-to-One.php b/manual/codes/Object relational mapping - Relations - Foreign key associations - One-to-Many, Many-to-One.php
deleted file mode 100644
index 7b8908c2d..000000000
--- a/manual/codes/Object relational mapping - Relations - Foreign key associations - One-to-Many, Many-to-One.php
+++ /dev/null
@@ -1,18 +0,0 @@
-ownsMany('Phonenumber','Phonenumber.user_id');
- }
- public function setTableDefition() {
- $this->hasColumn('name','string',50);
- $this->hasColumn('loginname','string',20);
- $this->hasColumn('password','string',16);
- }
-}
-class Phonenumber extends Doctrine_Record {
- public function setTableDefinition() {
- $this->hasColumn('phonenumber','string',50);
- $this->hasColumn('user_id','integer');
- }
-}
-?>
diff --git a/manual/codes/Object relational mapping - Relations - Foreign key associations - One-to-One.php b/manual/codes/Object relational mapping - Relations - Foreign key associations - One-to-One.php
deleted file mode 100644
index 23703b19c..000000000
--- a/manual/codes/Object relational mapping - Relations - Foreign key associations - One-to-One.php
+++ /dev/null
@@ -1,28 +0,0 @@
-hasOne('Address','Address.user_id');
- $this->ownsOne('Email','User.email_id');
- $this->ownsMany('Phonenumber','Phonenumber.user_id');
- }
- public function setTableDefition() {
- $this->hasColumn('name','string',50);
- $this->hasColumn('loginname','string',20);
- $this->hasColumn('password','string',16);
-
- // foreign key column for email ID
- $this->hasColumn('email_id','integer');
- }
-}
-class Email extends Doctrine_Record {
- public function setTableDefinition() {
- $this->hasColumn('address','string',150);
- }
-}
-class Address extends Doctrine_Record {
- public function setTableDefinition() {
- $this->hasColumn('street','string',50);
- $this->hasColumn('user_id','integer');
- }
-}
-?>
diff --git a/manual/codes/Object relational mapping - Relations - Foreign key associations - Tree structure.php b/manual/codes/Object relational mapping - Relations - Foreign key associations - Tree structure.php
deleted file mode 100644
index 768bbb663..000000000
--- a/manual/codes/Object relational mapping - Relations - Foreign key associations - Tree structure.php
+++ /dev/null
@@ -1,12 +0,0 @@
-hasOne('Task as Parent','Task.parent_id');
- $this->hasMany('Task as Subtask','Subtask.parent_id');
- }
- public function setTableDefinition() {
- $this->hasColumn('name','string',100);
- $this->hasColumn('parent_id','integer');
- }
-}
-?>
diff --git a/manual/codes/Object relational mapping - Relations - Inheritance - One table many classes.php b/manual/codes/Object relational mapping - Relations - Inheritance - One table many classes.php
deleted file mode 100644
index f7911739a..000000000
--- a/manual/codes/Object relational mapping - Relations - Inheritance - One table many classes.php
+++ /dev/null
@@ -1,14 +0,0 @@
-hasColumn('name','string',30);
- $this->hasColumn('username','string',20);
- $this->hasColumn('password','string',16);
- $this->hasColumn('created','integer',11);
- }
-}
-
-class User extends Entity { }
-
-class Group extends Entity { }
-?>
diff --git a/manual/codes/Object relational mapping - Relations - Inheritance - One table one class.php b/manual/codes/Object relational mapping - Relations - Inheritance - One table one class.php
deleted file mode 100644
index 7f1895f10..000000000
--- a/manual/codes/Object relational mapping - Relations - Inheritance - One table one class.php
+++ /dev/null
@@ -1,26 +0,0 @@
-hasColumn('name','string',30);
- $this->hasColumn('username','string',20);
- $this->hasColumn('password','string',16);
- $this->hasColumn('created','integer',11);
- }
-}
-
-class User extends Entity {
- public function setTableDefinition() {
- // the following method call is needed in
- // one-table-one-class inheritance
- parent::setTableDefinition();
- }
-}
-
-class Group extends Entity {
- public function setTableDefinition() {
- // the following method call is needed in
- // one-table-one-class inheritance
- parent::setTableDefinition();
- }
-}
-?>
diff --git a/manual/codes/Object relational mapping - Relations - Introduction.php b/manual/codes/Object relational mapping - Relations - Introduction.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/Object relational mapping - Relations - Join table associations - Many-to-Many.php b/manual/codes/Object relational mapping - Relations - Join table associations - Many-to-Many.php
deleted file mode 100644
index 8593fa7d0..000000000
--- a/manual/codes/Object relational mapping - Relations - Join table associations - Many-to-Many.php
+++ /dev/null
@@ -1,54 +0,0 @@
-hasMany('Group','Groupuser.group_id');
- }
- public function setTableDefinition() {
- $this->hasColumn('name','string',30);
- }
-}
-
-class Group extends Doctrine_Record {
- public function setUp() {
- $this->hasMany('User','Groupuser.user_id');
- }
- public function setTableDefinition() {
- $this->hasColumn('name','string',30);
- }
-}
-
-class Groupuser extends Doctrine_Record {
- public function setTableDefinition() {
- $this->hasColumn('user_id','integer');
- $this->hasColumn('group_id','integer');
- }
-}
-
-
-$user = new User();
-
-// add two groups
-$user->Group[0]->name = 'First Group';
-
-$user->Group[1]->name = 'Second Group';
-
-// save changes into database
-$user->save();
-
-// deleting the associations between user and groups it belongs to
-
-$user->Groupuser->delete();
-
-$groups = new Doctrine_Collection($conn->getTable('Group'));
-
-$groups[0]->name = 'Third Group';
-
-$groups[1]->name = 'Fourth Group';
-
-$user->Group[2] = $groups[0];
-// $user will now have 3 groups
-
-$user->Group = $groups;
-// $user will now have two groups 'Third Group' and 'Fourth Group'
-
-?>
diff --git a/manual/codes/Object relational mapping - Relations - Join table associations - One-to-Many, Many-to-One.php b/manual/codes/Object relational mapping - Relations - Join table associations - One-to-Many, Many-to-One.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/Object relational mapping - Relations - Join table associations - One-to-One.php b/manual/codes/Object relational mapping - Relations - Join table associations - One-to-One.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/Object relational mapping - Relations - Join table associations - Self-referencing.php b/manual/codes/Object relational mapping - Relations - Join table associations - Self-referencing.php
deleted file mode 100644
index 3a441dcda..000000000
--- a/manual/codes/Object relational mapping - Relations - Join table associations - Self-referencing.php
+++ /dev/null
@@ -1,16 +0,0 @@
-hasMany('User as Friend','UserReference.user_id-user_id2');
- }
- public function setTableDefinition() {
- $this->hasColumn('name','string',30);
- }
-}
-class UserReference extends Doctrine_Record {
- public function setTableDefinition() {
- $this->hasColumn('user_id','integer');
- $this->hasColumn('user_id2','integer');
- }
-}
-?>
diff --git a/manual/codes/Object relational mapping - Relations - Relation aliases.php b/manual/codes/Object relational mapping - Relations - Relation aliases.php
deleted file mode 100644
index 52cfb981d..000000000
--- a/manual/codes/Object relational mapping - Relations - Relation aliases.php
+++ /dev/null
@@ -1,26 +0,0 @@
-hasColumn('name', 'string', 100);
- $this->hasColumn('description', 'string', 5000);
- }
- public function setUp() {
- // notice the 'as' keyword here
- $this->ownsMany('Forum_Thread as Threads', 'Forum_Thread.board_id');
- }
-}
-
-class Forum_Thread extends Doctrine_Record {
- public function setTableDefinition() {
- $this->hasColumn('board_id', 'integer', 10);
- $this->hasColumn('updated', 'integer', 10);
- $this->hasColumn('closed', 'integer', 1);
- }
- public function setUp() {
- // notice the 'as' keyword here
- $this->hasOne('Forum_Board as Board', 'Forum_Thread.board_id');
- }
-}
-$board = new Board();
-$board->Threads[0]->updated = time();
-?>
diff --git a/manual/codes/Object relational mapping - Table and class naming.php b/manual/codes/Object relational mapping - Table and class naming.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/Operators - Logical operators.php b/manual/codes/Operators - Logical operators.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/Real world examples - Album lister.php b/manual/codes/Real world examples - Album lister.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/Real world examples - Forum application.php b/manual/codes/Real world examples - Forum application.php
deleted file mode 100644
index dbe0fe77e..000000000
--- a/manual/codes/Real world examples - Forum application.php
+++ /dev/null
@@ -1,52 +0,0 @@
-hasColumn("root_category_id", "integer", 10);
- $this->hasColumn("parent_category_id", "integer", 10);
- $this->hasColumn("name", "string", 50);
- $this->hasColumn("description", "string", 99999);
- }
- public function setUp() {
- $this->hasMany("Forum_Category as Subcategory", "Subcategory.parent_category_id");
- $this->hasOne("Forum_Category as Rootcategory", "Forum_Category.root_category_id");
- }
-}
-class Forum_Board extends Doctrine_Record {
- public function setTableDefinition() {
- $this->hasColumn("category_id", "integer", 10);
- $this->hasColumn("name", "string", 100);
- $this->hasColumn("description", "string", 5000);
- }
- public function setUp() {
- $this->hasOne("Forum_Category as Category", "Forum_Board.category_id");
- $this->ownsMany("Forum_Thread as Threads", "Forum_Thread.board_id");
- }
-}
-
-class Forum_Entry extends Doctrine_Record {
- public function setTableDefinition() {
- $this->hasColumn("author", "string", 50);
- $this->hasColumn("topic", "string", 100);
- $this->hasColumn("message", "string", 99999);
- $this->hasColumn("parent_entry_id", "integer", 10);
- $this->hasColumn("thread_id", "integer", 10);
- $this->hasColumn("date", "integer", 10);
- }
- public function setUp() {
- $this->hasOne("Forum_Entry as Parent", "Forum_Entry.parent_entry_id");
- $this->hasOne("Forum_Thread as Thread", "Forum_Entry.thread_id");
- }
-}
-
-class Forum_Thread extends Doctrine_Record {
- public function setTableDefinition() {
- $this->hasColumn("board_id", "integer", 10);
- $this->hasColumn("updated", "integer", 10);
- $this->hasColumn("closed", "integer", 1);
- }
- public function setUp() {
- $this->hasOne("Forum_Board as Board", "Forum_Thread.board_id");
- $this->ownsMany("Forum_Entry as Entries", "Forum_Entry.thread_id");
- }
-}
-?>
diff --git a/manual/codes/Real world examples - User management system.php b/manual/codes/Real world examples - User management system.php
deleted file mode 100644
index d0f8eb853..000000000
--- a/manual/codes/Real world examples - User management system.php
+++ /dev/null
@@ -1,78 +0,0 @@
-ownsOne("Email","Entity.email_id");
- $this->ownsMany("Phonenumber","Phonenumber.entity_id");
- $this->setAttribute(Doctrine::ATTR_FETCHMODE,Doctrine::FETCH_BATCH);
- $this->setAttribute(Doctrine::ATTR_LISTENER,new EntityListener());
- }
- public function setTableDefinition() {
- $this->hasColumn("name","string",50);
- $this->hasColumn("loginname","string",20);
- $this->hasColumn("password","string",16);
- $this->hasColumn("type","integer",1);
- $this->hasColumn("created","integer",11);
- $this->hasColumn("updated","integer",11);
- $this->hasColumn("email_id","integer");
- }
-}
-class Group extends Entity {
- public function setUp() {
- parent::setUp();
- $this->hasMany("User","Groupuser.user_id");
- $this->setInheritanceMap(array("type"=>1));
- }
-}
-class User extends Entity {
- public function setUp() {
- parent::setUp();
- $this->hasMany("Group","Groupuser.group_id");
- $this->setInheritanceMap(array("type"=>0));
- }
-}
-class Groupuser extends Doctrine_Record {
- public function setTableDefinition() {
- $this->hasColumn("group_id","integer");
- $this->hasColumn("user_id","integer");
- }
-}
-
-class Phonenumber extends Doctrine_Record {
- public function setTableDefinition() {
- $this->hasColumn("phonenumber","string",20);
- $this->hasColumn("entity_id","integer");
- }
-}
-class Email extends Doctrine_Record {
- public function setTableDefinition() {
- $this->hasColumn("address","string",150,"email|unique");
- }
-}
-class EntityListener extends Doctrine_EventListener {
- public function onPreUpdate(Doctrine_Record $record) {
- $record->updated = time();
- }
- public function onPreInsert(Doctrine_Record $record) {
- $record->created = time();
- }
-}
-
-// USER MANAGEMENT SYSTEM IN ACTION:
-
-$manager = Doctrine_Manager::getInstance();
-
-$conn = $manager->openConnection(new PDO("DSN","username","password"));
-
-$user = new User();
-
-$user->name = "Jack Daniels";
-$user->Email->address = "jackdaniels@drinkmore.info";
-$user->Phonenumber[0]->phonenumber = "123 123";
-$user->Phonenumber[1]->phonenumber = "133 133";
-$user->save();
-
-$user->Group[0]->name = "beer lovers";
-$user->Group[0]->Email->address = "beerlovers@drinkmore.info";
-$user->Group[0]->save();
-
-?>
diff --git a/manual/codes/Runtime classes - Doctrine_Record.php b/manual/codes/Runtime classes - Doctrine_Record.php
deleted file mode 100644
index 0264a5ccf..000000000
--- a/manual/codes/Runtime classes - Doctrine_Record.php
+++ /dev/null
@@ -1,40 +0,0 @@
-find(2);
-
-// get state
-$state = $user->getState();
-
-print $user->name;
-
-print $user["name"];
-
-print $user->get("name");
-
-$user->name = "Jack Daniels";
-
-$user->set("name","Jack Daniels");
-
-// serialize record
-
-$serialized = serialize($user);
-
-$user = unserialize($serialized);
-
-// create a copy
-
-$copy = $user->copy();
-
-// get primary key
-
-$id = $user->getID();
-
-// print lots of useful info
-
-print $user;
-
-// save all the properties and composites
-$user->save();
-
-// delete this data access object and related objects
-$user->delete();
-?>
diff --git a/manual/codes/Runtime classes - Doctrine_Session.php b/manual/codes/Runtime classes - Doctrine_Session.php
deleted file mode 100644
index dccfa2d05..000000000
--- a/manual/codes/Runtime classes - Doctrine_Session.php
+++ /dev/null
@@ -1,30 +0,0 @@
-openConnection(Doctrine_Db::getConnection("schema://username:password@hostname/database"));
-
-// get connection state:
-switch($sess):
- case Doctrine_Connection::STATE_BUSY:
- // multiple open transactions
- break;
- case Doctrine_Connection::STATE_ACTIVE:
- // one open transaction
- break;
- case Doctrine_Connection::STATE_CLOSED:
- // closed state
- break;
- case Doctrine_Connection::STATE_OPEN:
- // open state and zero open transactions
- break;
-endswitch;
-
-// getting database handler
-
-$dbh = $sess->getDBH();
-
-// flushing the connection
-$sess->flush();
-
-
-// print lots of useful info about connection:
-print $sess;
-?>
diff --git a/manual/codes/Technology - Architecture.php b/manual/codes/Technology - Architecture.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/Technology - Design patterns used.php b/manual/codes/Technology - Design patterns used.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/Technology - Internal optimizations - DELETE.php b/manual/codes/Technology - Internal optimizations - DELETE.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/Technology - Internal optimizations - INSERT.php b/manual/codes/Technology - Internal optimizations - INSERT.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/Technology - Internal optimizations - UPDATE.php b/manual/codes/Technology - Internal optimizations - UPDATE.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/Technology - Speed.php b/manual/codes/Technology - Speed.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/Transactions - Deadlocks.php b/manual/codes/Transactions - Deadlocks.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/Transactions - Introduction.php b/manual/codes/Transactions - Introduction.php
deleted file mode 100644
index 1d03edd11..000000000
--- a/manual/codes/Transactions - Introduction.php
+++ /dev/null
@@ -1,13 +0,0 @@
-beginTransaction();
-
-$user = new User();
-$user->name = 'New user';
-$user->save();
-
-$user = $conn->getTable('User')->find(5);
-$user->name = 'Modified user';
-$user->save();
-
-$conn->commit(); // all the queries are executed here
-?>
diff --git a/manual/codes/Transactions - Isolation levels.php b/manual/codes/Transactions - Isolation levels.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/Transactions - Lock modes.php b/manual/codes/Transactions - Lock modes.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/Transactions - Locking strategies - Optimistic locking.php b/manual/codes/Transactions - Locking strategies - Optimistic locking.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/Transactions - Locking strategies - Pessimistic locking.php b/manual/codes/Transactions - Locking strategies - Pessimistic locking.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/Transactions - Nesting.php b/manual/codes/Transactions - Nesting.php
deleted file mode 100644
index 405831c5f..000000000
--- a/manual/codes/Transactions - Nesting.php
+++ /dev/null
@@ -1,23 +0,0 @@
-beginTransaction();
-
- $user->save();
-
- $group->save();
-
- $conn->commit();
-}
-
-try {
- $conn->beginTransaction();
-
- saveUserAndGroup($conn,$user,$group);
- saveUserAndGroup($conn,$user2,$group2);
- saveUserAndGroup($conn,$user3,$group3);
-
- $conn->commit();
-} catch(Doctrine_Exception $e) {
- $conn->rollback();
-}
-?>
diff --git a/manual/codes/Transactions - Savepoints.php b/manual/codes/Transactions - Savepoints.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/Transactions - Unit of work.php b/manual/codes/Transactions - Unit of work.php
deleted file mode 100644
index dd2acb22d..000000000
--- a/manual/codes/Transactions - Unit of work.php
+++ /dev/null
@@ -1,18 +0,0 @@
-beginTransaction();
-
-$user = new User();
-$user->name = 'New user';
-$user->save();
-
-$user = $conn->getTable('User')->find(5);
-$user->name = 'Modified user';
-$user->save();
-
-
-$pending = $conn->getInserts(); // an array containing one element
-
-$pending = $conn->getUpdates(); // an array containing one element
-
-$conn->commit(); // all the queries are executed here
-?>
diff --git a/manual/codes/Working with objects - Component overview - Collection - Accessing elements.php b/manual/codes/Working with objects - Component overview - Collection - Accessing elements.php
deleted file mode 100644
index b6d08a5bb..000000000
--- a/manual/codes/Working with objects - Component overview - Collection - Accessing elements.php
+++ /dev/null
@@ -1,15 +0,0 @@
-getTable("User");
-
-$users = $table->findAll();
-
-// accessing elements with ArrayAccess interface
-
-$users[0]->name = "Jack Daniels";
-
-$users[1]->name = "John Locke";
-
-// accessing elements with get()
-
-print $users->get(1)->name;
-?>
diff --git a/manual/codes/Working with objects - Component overview - Collection - Adding new elements.php b/manual/codes/Working with objects - Component overview - Collection - Adding new elements.php
deleted file mode 100644
index dec8c7693..000000000
--- a/manual/codes/Working with objects - Component overview - Collection - Adding new elements.php
+++ /dev/null
@@ -1,8 +0,0 @@
-findAll();
-
-print count($users); // 5
-
-$users[5]->name = "new user 1";
-$users[6]->name = "new user 2";
-?>
diff --git a/manual/codes/Working with objects - Component overview - Collection - Collection expanding.php b/manual/codes/Working with objects - Component overview - Collection - Collection expanding.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/Working with objects - Component overview - Collection - Deleting collection.php b/manual/codes/Working with objects - Component overview - Collection - Deleting collection.php
deleted file mode 100644
index 125cfba6a..000000000
--- a/manual/codes/Working with objects - Component overview - Collection - Deleting collection.php
+++ /dev/null
@@ -1,7 +0,0 @@
-findByDql("name LIKE '%John%'");
-
-$users->delete();
-?>
diff --git a/manual/codes/Working with objects - Component overview - Collection - Fetching strategies.php b/manual/codes/Working with objects - Component overview - Collection - Fetching strategies.php
deleted file mode 100644
index d36911490..000000000
--- a/manual/codes/Working with objects - Component overview - Collection - Fetching strategies.php
+++ /dev/null
@@ -1,52 +0,0 @@
-getTable("User");
-
-$table->setAttribute(Doctrine::ATTR_FETCHMODE, Doctrine::FETCH_IMMEDIATE);
-
-$users = $table->findAll();
-
-// or
-
-$users = $conn->query("FROM User-I"); // immediate collection
-
-foreach($users as $user) {
- print $user->name;
-}
-
-
-$table->setAttribute(Doctrine::ATTR_FETCHMODE, Doctrine::FETCH_LAZY);
-
-$users = $table->findAll();
-
-// or
-
-$users = $conn->query("FROM User-L"); // lazy collection
-
-foreach($users as $user) {
- print $user->name;
-}
-
-$table->setAttribute(Doctrine::ATTR_FETCHMODE, Doctrine::FETCH_BATCH);
-
-$users = $table->findAll();
-
-// or
-
-$users = $conn->query("FROM User-B"); // batch collection
-
-foreach($users as $user) {
- print $user->name;
-}
-
-$table->setAttribute(Doctrine::ATTR_FETCHMODE, Doctrine::FETCH_OFFSET);
-
-$users = $table->findAll();
-
-// or
-
-$users = $conn->query("FROM User-O"); // offset collection
-
-foreach($users as $user) {
- print $user->name;
-}
-?>
diff --git a/manual/codes/Working with objects - Component overview - Collection - Getting collection count.php b/manual/codes/Working with objects - Component overview - Collection - Getting collection count.php
deleted file mode 100644
index a2e88a5d1..000000000
--- a/manual/codes/Working with objects - Component overview - Collection - Getting collection count.php
+++ /dev/null
@@ -1,9 +0,0 @@
-findAll();
-
-$users->count();
-
-// or
-
-count($users); // Doctrine_Collection implements Countable interface
-?>
diff --git a/manual/codes/Working with objects - Component overview - Collection - Introduction.php b/manual/codes/Working with objects - Component overview - Collection - Introduction.php
deleted file mode 100644
index edb2c33e9..000000000
--- a/manual/codes/Working with objects - Component overview - Collection - Introduction.php
+++ /dev/null
@@ -1,18 +0,0 @@
-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();
-?>
diff --git a/manual/codes/Working with objects - Component overview - Collection - Key mapping.php b/manual/codes/Working with objects - Component overview - Collection - Key mapping.php
deleted file mode 100644
index c2081f544..000000000
--- a/manual/codes/Working with objects - Component overview - Collection - Key mapping.php
+++ /dev/null
@@ -1,31 +0,0 @@
-setAttribute(Doctrine::ATTR_COLL_KEY, 'id');
-
-// now user collections will use the values of
-// id column as element indexes
-
-$users = $user->getTable()->findAll();
-
-foreach($users as $id => $user) {
- print $id . $user->name;
-}
-
-// mapping name column
-
-$user = new User();
-
-$user->setAttribute(Doctrine::ATTR_COLL_KEY, 'name');
-
-// now user collections will use the values of
-// name column as element indexes
-
-$users = $user->getTable()->findAll();
-
-foreach($users as $name => $user) {
- print $name . $user->type;
-}
-?>
diff --git a/manual/codes/Working with objects - Component overview - Collection - Loading related records.php b/manual/codes/Working with objects - Component overview - Collection - Loading related records.php
deleted file mode 100644
index 4407e7240..000000000
--- a/manual/codes/Working with objects - Component overview - Collection - Loading related records.php
+++ /dev/null
@@ -1,20 +0,0 @@
-query("FROM User");
-
-// now lets load phonenumbers for all users
-
-$users->loadRelated("Phonenumber");
-
-foreach($users as $user) {
- print $user->Phonenumber->phonenumber;
- // no additional db queries needed here
-}
-
-// the loadRelated works an any relation, even associations:
-
-$users->loadRelated("Group");
-
-foreach($users as $user) {
- print $user->Group->name;
-}
-?>
diff --git a/manual/codes/Working with objects - Component overview - Collection - Saving the collection.php b/manual/codes/Working with objects - Component overview - Collection - Saving the collection.php
deleted file mode 100644
index 7ef541270..000000000
--- a/manual/codes/Working with objects - Component overview - Collection - Saving the collection.php
+++ /dev/null
@@ -1,9 +0,0 @@
-findAll();
-
-$users[0]->name = "Jack Daniels";
-
-$users[1]->name = "John Locke";
-
-$users->save();
-?>
diff --git a/manual/codes/Working with objects - Component overview - Connection - Available drivers.php b/manual/codes/Working with objects - Component overview - Connection - Available drivers.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/Working with objects - Component overview - Connection - Availible drivers.php b/manual/codes/Working with objects - Component overview - Connection - Availible drivers.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/Working with objects - Component overview - Connection - Flushing the connection.php b/manual/codes/Working with objects - Component overview - Connection - Flushing the connection.php
deleted file mode 100644
index f5f99e967..000000000
--- a/manual/codes/Working with objects - Component overview - Connection - Flushing the connection.php
+++ /dev/null
@@ -1,11 +0,0 @@
-name = 'Jack';
-
-$group = $conn->create('Group');
-$group->name = 'Drinking Club';
-
-// saves all the changed objects into database
-
-$conn->flush();
-?>
diff --git a/manual/codes/Working with objects - Component overview - Connection - Getting a table object.php b/manual/codes/Working with objects - Component overview - Connection - Getting a table object.php
deleted file mode 100644
index ea9e6e48e..000000000
--- a/manual/codes/Working with objects - Component overview - Connection - Getting a table object.php
+++ /dev/null
@@ -1,11 +0,0 @@
-openConnection(new PDO('dsn','username','password'));
-
-// getting a table object
-
-$table = $conn->getTable('User');
-?>
diff --git a/manual/codes/Working with objects - Component overview - Connection - Getting connection state.php b/manual/codes/Working with objects - Component overview - Connection - Getting connection state.php
deleted file mode 100644
index 42b184b3c..000000000
--- a/manual/codes/Working with objects - Component overview - Connection - Getting connection state.php
+++ /dev/null
@@ -1,16 +0,0 @@
-getState()):
- case Doctrine_Connection::STATE_ACTIVE:
- // connection open and zero open transactions
- break;
- case Doctrine_Connection::STATE_ACTIVE:
- // one open transaction
- break;
- case Doctrine_Connection::STATE_BUSY:
- // multiple open transactions
- break;
- case Doctrine_Connection::STATE_CLOSED:
- // connection closed
- break;
-endswitch;
-?>
diff --git a/manual/codes/Working with objects - Component overview - Connection - Querying the database.php b/manual/codes/Working with objects - Component overview - Connection - Querying the database.php
deleted file mode 100644
index 531c6fdce..000000000
--- a/manual/codes/Working with objects - Component overview - Connection - Querying the database.php
+++ /dev/null
@@ -1,14 +0,0 @@
-query('FROM User');
-
-// select all users where user email is jackdaniels@drinkmore.info
-
-$users = $conn->query("FROM User WHERE User.Email.address = 'jackdaniels@drinkmore.info'");
-
-// using prepared statements
-
-$users = $conn->query('FROM User WHERE User.name = ?', array('Jack'));
-?>
diff --git a/manual/codes/Working with objects - Component overview - Db - Chaining listeners.php b/manual/codes/Working with objects - Component overview - Db - Chaining listeners.php
deleted file mode 100644
index 3f3d7de5a..000000000
--- a/manual/codes/Working with objects - Component overview - Db - Chaining listeners.php
+++ /dev/null
@@ -1,34 +0,0 @@
-queries++;
- }
- public function count() {
- return count($this->queries);
- }
-}
-class OutputLogger extends Doctrine_Overloadable {
- public function __call($m, $a) {
- print $m." called!";
- }
-}
-$counter = new Counter();
-
-$dbh->addListener($counter);
-$dbh->addListener(new OutputLogger());
-
-$dbh->query("SELECT * FROM foo");
-// prints:
-// onPreQuery called!
-// onQuery called!
-
-print $counter->count(); // 1
-
-?>
diff --git a/manual/codes/Working with objects - Component overview - Db - Connecting to a database.php b/manual/codes/Working with objects - Component overview - Db - Connecting to a database.php
deleted file mode 100644
index d3f5a12fa..000000000
--- a/manual/codes/Working with objects - Component overview - Db - Connecting to a database.php
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/manual/codes/Working with objects - Component overview - Db - Introduction.php b/manual/codes/Working with objects - Component overview - Db - Introduction.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/Working with objects - Component overview - Db - Using event listeners.php b/manual/codes/Working with objects - Component overview - Db - Using event listeners.php
deleted file mode 100644
index 43ef6a141..000000000
--- a/manual/codes/Working with objects - Component overview - Db - Using event listeners.php
+++ /dev/null
@@ -1,36 +0,0 @@
-getQuery();
- }
-}
-
-$dbh->setListener(new MyLogger());
-
-$dbh->query("SELECT * FROM foo");
-// prints:
-// database is going to be queried
-// executed: SELECT * FROM foo
-
-
-class MyLogger2 extends Doctrine_Overloadable {
- public function __call($m, $a) {
- print $m." called!";
- }
-}
-
-$dbh->setListener(new MyLogger2());
-
-$dbh->exec("DELETE FROM foo");
-// prints:
-// onPreExec called!
-// onExec called!
-?>
diff --git a/manual/codes/Working with objects - Component overview - Exceptions - List of exceptions.php b/manual/codes/Working with objects - Component overview - Exceptions - List of exceptions.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/Working with objects - Component overview - Exceptions - Overview.php b/manual/codes/Working with objects - Component overview - Exceptions - Overview.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/Working with objects - Component overview - Manager - Introduction.php b/manual/codes/Working with objects - Component overview - Manager - Introduction.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/Working with objects - Component overview - Manager - Managing connections.php b/manual/codes/Working with objects - Component overview - Manager - Managing connections.php
deleted file mode 100644
index 80e1a920f..000000000
--- a/manual/codes/Working with objects - Component overview - Manager - Managing connections.php
+++ /dev/null
@@ -1,25 +0,0 @@
-openConnection(new PDO('dsn','username','password'), 'connection 1');
-
-// open second connection
-
-$conn2 = $manager->openConnection(new PDO('dsn2','username2','password2'), 'connection 2');
-
-$manager->getCurrentConnection(); // $conn2
-
-$manager->setCurrentConnection('connection 1');
-
-$manager->getCurrentConnection(); // $conn
-
-// iterating through connections
-
-foreach($manager as $conn) {
-
-}
-?>
diff --git a/manual/codes/Working with objects - Component overview - Manager - Opening a new connection.php b/manual/codes/Working with objects - Component overview - Manager - Opening a new connection.php
deleted file mode 100644
index 98f417c46..000000000
--- a/manual/codes/Working with objects - Component overview - Manager - Opening a new connection.php
+++ /dev/null
@@ -1,18 +0,0 @@
-openConnection();
-
-// or if you want to use Doctrine Doctrine_Db and its
-// performance monitoring capabilities
-
-$dsn = 'schema://username:password@dsn/dbname';
-$dbh = Doctrine_Db::getConnection($dsn);
-$conn = $manager->openConnection();
-?>
diff --git a/manual/codes/Working with objects - Component overview - Query - Aggregate functions.php b/manual/codes/Working with objects - Component overview - Query - Aggregate functions.php
deleted file mode 100644
index 52af72495..000000000
--- a/manual/codes/Working with objects - Component overview - Query - Aggregate functions.php
+++ /dev/null
@@ -1,15 +0,0 @@
-from('User(COUNT(id))');
-
-// returns an array
-$a = $q->execute();
-
-// selecting multiple aggregate values:
-$q = new Doctrine_Query();
-
-$q->from('User(COUNT(id)).Phonenumber(MAX(phonenumber))');
-
-$a = $q->execute();
-?>
diff --git a/manual/codes/Working with objects - Component overview - Query - Bound parameters.php b/manual/codes/Working with objects - Component overview - Query - Bound parameters.php
deleted file mode 100644
index 9bb9a97af..000000000
--- a/manual/codes/Working with objects - Component overview - Query - Bound parameters.php
+++ /dev/null
@@ -1,6 +0,0 @@
-from("User")
- ->where("User.name = ?");
-
-$query->execute(array('Jack Daniels'));
-?>
diff --git a/manual/codes/Working with objects - Component overview - Query - DQL - SQL conversion.php b/manual/codes/Working with objects - Component overview - Query - DQL - SQL conversion.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/Working with objects - Component overview - Query - FROM - selecting tables.php b/manual/codes/Working with objects - Component overview - Query - FROM - selecting tables.php
deleted file mode 100644
index 484a24f09..000000000
--- a/manual/codes/Working with objects - Component overview - Query - FROM - selecting tables.php
+++ /dev/null
@@ -1,24 +0,0 @@
-from("FROM Group");
-
-// find all users and user emails
-
-$coll = $q->from("FROM User u LEFT JOIN u.Email e");
-
-// find all users and user emails with only user name and
-// age + email address loaded
-
-$coll = $q->select('u.name, u.age, e.address')
- ->from('FROM User u')
- ->leftJoin('u.Email e')
- ->execute();
-
-// find all users, user email and user phonenumbers
-
-$coll = $q->from('FROM User u')
- ->innerJoin('u.Email e')
- ->innerJoin('u.Phonenumber p')
- ->execute();
-?>
diff --git a/manual/codes/Working with objects - Component overview - Query - HAVING conditions.php b/manual/codes/Working with objects - Component overview - Query - HAVING conditions.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/Working with objects - Component overview - Query - Introduction.php b/manual/codes/Working with objects - Component overview - Query - Introduction.php
deleted file mode 100644
index 218466fa7..000000000
--- a/manual/codes/Working with objects - Component overview - Query - Introduction.php
+++ /dev/null
@@ -1,12 +0,0 @@
-from('User')->execute();
-?>
diff --git a/manual/codes/Working with objects - Component overview - Query - LIMIT and OFFSET - limiting the query results.php b/manual/codes/Working with objects - Component overview - Query - LIMIT and OFFSET - limiting the query results.php
deleted file mode 100644
index 5b94b58ec..000000000
--- a/manual/codes/Working with objects - Component overview - Query - LIMIT and OFFSET - limiting the query results.php
+++ /dev/null
@@ -1,13 +0,0 @@
-from('User u LEFT JOIN u.Email e')->limit(10);
-
-// find the first ten users starting from the user number 5
-
-$coll = $q->from('User u')->limit(10)->offset(5);
-
-?>
diff --git a/manual/codes/Working with objects - Component overview - Query - Method overloading.php b/manual/codes/Working with objects - Component overview - Query - Method overloading.php
deleted file mode 100644
index d9aae392d..000000000
--- a/manual/codes/Working with objects - Component overview - Query - Method overloading.php
+++ /dev/null
@@ -1,20 +0,0 @@
-openConnection(new PDO("dsn","username","password"));
-
-$query = new Doctrine_Query($conn);
-
-$query->from("User-b")
- ->where("User.name LIKE 'Jack%'")
- ->orderby("User.created")
- ->limit(5);
-
-$users = $query->execute();
-
-$query->from("User.Group.Phonenumber")
- ->where("User.Group.name LIKE 'Actors%'")
- ->orderby("User.name")
- ->limit(10)
- ->offset(5);
-
-$users = $query->execute();
-?>
diff --git a/manual/codes/Working with objects - Component overview - Query - ORDER BY - sorting query results.php b/manual/codes/Working with objects - Component overview - Query - ORDER BY - sorting query results.php
deleted file mode 100644
index beaa5e092..000000000
--- a/manual/codes/Working with objects - Component overview - Query - ORDER BY - sorting query results.php
+++ /dev/null
@@ -1,20 +0,0 @@
-from('User u')->orderby('u.name DESC');
-
-// find all users sort by name ascending
-
-$users = $q->from('User u')->orderby('u.name ASC');
-
-// find all users and their emails, sort by email address in ascending order
-
-$users = $q->from('User u')->leftJoin('u.Email e')->orderby('e.address');
-
-// find all users and their emails, sort by user name and email address
-
-$users = $q->from('User u')->leftJoin('u.Email e')
- ->addOrderby('u.name')->addOrderby('e.address');
-?>
diff --git a/manual/codes/Working with objects - Component overview - Query - Relation operators.php b/manual/codes/Working with objects - Component overview - Query - Relation operators.php
deleted file mode 100644
index a917daea4..000000000
--- a/manual/codes/Working with objects - Component overview - Query - Relation operators.php
+++ /dev/null
@@ -1,15 +0,0 @@
-from('User u')->innerJoin('u.Email e');
-
-$query->execute();
-
-// executed SQL query:
-// SELECT ... FROM user INNER JOIN email ON ...
-
-$query->from('User u')->leftJoin('u.Email e');
-
-$query->execute();
-
-// executed SQL query:
-// SELECT ... FROM user LEFT JOIN email ON ...
-?>
diff --git a/manual/codes/Working with objects - Component overview - Query - WHERE - setting query conditions.php b/manual/codes/Working with objects - Component overview - Query - WHERE - setting query conditions.php
deleted file mode 100644
index d3f5a12fa..000000000
--- a/manual/codes/Working with objects - Component overview - Query - WHERE - setting query conditions.php
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/manual/codes/Working with objects - Component overview - RawSql - Adding components.php b/manual/codes/Working with objects - Component overview - RawSql - Adding components.php
deleted file mode 100644
index be3f2ff44..000000000
--- a/manual/codes/Working with objects - Component overview - RawSql - Adding components.php
+++ /dev/null
@@ -1,13 +0,0 @@
-parseQuery("SELECT {entity.*}, {phonenumber.*}
- FROM entity
- LEFT JOIN phonenumber
- ON phonenumber.entity_id = entity.id");
-
-$query->addComponent("entity", "Entity");
-$query->addComponent("phonenumber", "Entity.Phonenumber");
-
-$entities = $query->execute();
-?>
diff --git a/manual/codes/Working with objects - Component overview - RawSql - Introduction.php b/manual/codes/Working with objects - Component overview - RawSql - Introduction.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/Working with objects - Component overview - RawSql - Method overloading.php b/manual/codes/Working with objects - Component overview - RawSql - Method overloading.php
deleted file mode 100644
index e99f6f747..000000000
--- a/manual/codes/Working with objects - Component overview - RawSql - Method overloading.php
+++ /dev/null
@@ -1,10 +0,0 @@
-select('{entity.name}')
- ->from('entity');
-
-$query->addComponent("entity", "User");
-
-$coll = $query->execute();
-?>
diff --git a/manual/codes/Working with objects - Component overview - RawSql - Using SQL.php b/manual/codes/Working with objects - Component overview - RawSql - Using SQL.php
deleted file mode 100644
index a409801f4..000000000
--- a/manual/codes/Working with objects - Component overview - RawSql - Using SQL.php
+++ /dev/null
@@ -1,7 +0,0 @@
-parseQuery("SELECT {entity.name} FROM entity");
-
-$entities = $query->execute();
-?>
diff --git a/manual/codes/Working with objects - Component overview - Record - Accessing properties.php b/manual/codes/Working with objects - Component overview - Record - Accessing properties.php
deleted file mode 100644
index f02e1d2c7..000000000
--- a/manual/codes/Working with objects - Component overview - Record - Accessing properties.php
+++ /dev/null
@@ -1,21 +0,0 @@
-find(3);
-
-// access property through overloading
-
-$name = $user->name;
-
-// access property with get()
-
-$name = $user->get("name");
-
-// access property with ArrayAccess interface
-
-$name = $user['name'];
-
-// iterating through properties
-
-foreach($user as $key => $value) {
-
-}
-?>
diff --git a/manual/codes/Working with objects - Component overview - Record - Callbacks.php b/manual/codes/Working with objects - Component overview - Record - Callbacks.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/Working with objects - Component overview - Record - Checking existence.php b/manual/codes/Working with objects - Component overview - Record - Checking existence.php
deleted file mode 100644
index 19b2d36c3..000000000
--- a/manual/codes/Working with objects - Component overview - Record - Checking existence.php
+++ /dev/null
@@ -1,10 +0,0 @@
-exists(); // false
-
-$record->name = 'someone';
-$record->save();
-
-$record->exists(); // true
-?>
diff --git a/manual/codes/Working with objects - Component overview - Record - Creating new records.php b/manual/codes/Working with objects - Component overview - Record - Creating new records.php
deleted file mode 100644
index 182505abd..000000000
--- a/manual/codes/Working with objects - Component overview - Record - Creating new records.php
+++ /dev/null
@@ -1,20 +0,0 @@
-create("User");
-
-// alternative way:
-
-$table = $conn->getTable("User");
-
-$user = $table->create();
-
-// the simpliest way:
-
-$user = new User();
-
-
-// records support array access
-$user["name"] = "John Locke";
-
-// save user into database
-$user->save();
-?>
diff --git a/manual/codes/Working with objects - Component overview - Record - Deleting records.php b/manual/codes/Working with objects - Component overview - Record - Deleting records.php
deleted file mode 100644
index d15b0cd14..000000000
--- a/manual/codes/Working with objects - Component overview - Record - Deleting records.php
+++ /dev/null
@@ -1,16 +0,0 @@
-getTable("User");
-
-$user = $table->find(2);
-
-// deletes user and all related composite objects
-if($user !== false)
- $user->delete();
-
-
-$users = $table->findAll();
-
-
-// delete all users and their related composite objects
-$users->delete();
-?>
diff --git a/manual/codes/Working with objects - Component overview - Record - Getting object copy.php b/manual/codes/Working with objects - Component overview - Record - Getting object copy.php
deleted file mode 100644
index e5d527d75..000000000
--- a/manual/codes/Working with objects - Component overview - Record - Getting object copy.php
+++ /dev/null
@@ -1,3 +0,0 @@
-copy();
-?>
diff --git a/manual/codes/Working with objects - Component overview - Record - Getting record state.php b/manual/codes/Working with objects - Component overview - Record - Getting record state.php
deleted file mode 100644
index fd2bd3b4a..000000000
--- a/manual/codes/Working with objects - Component overview - Record - Getting record state.php
+++ /dev/null
@@ -1,31 +0,0 @@
-getState();
-
-switch($state):
- case Doctrine_Record::STATE_PROXY:
- // record is in proxy state,
- // meaning its persistent but not all of its properties are
- // loaded from the database
- break;
- case Doctrine_Record::STATE_TCLEAN:
- // record is transient clean,
- // meaning its transient and
- // none of its properties are changed
- break;
- case Doctrine_Record::STATE_TDIRTY:
- // record is transient dirty,
- // meaning its transient and
- // some of its properties are changed
- break;
- case Doctrine_Record::STATE_DIRTY:
- // record is dirty,
- // meaning its persistent and
- // some of its properties are changed
- break;
- case Doctrine_Record::STATE_CLEAN:
- // record is clean,
- // meaning its persistent and
- // none of its properties are changed
- break;
-endswitch;
-?>
diff --git a/manual/codes/Working with objects - Component overview - Record - Introduction.php b/manual/codes/Working with objects - Component overview - Record - Introduction.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/Working with objects - Component overview - Record - Retrieving existing records.php b/manual/codes/Working with objects - Component overview - Record - Retrieving existing records.php
deleted file mode 100644
index 5b7623cdb..000000000
--- a/manual/codes/Working with objects - Component overview - Record - Retrieving existing records.php
+++ /dev/null
@@ -1,23 +0,0 @@
-getTable("User");
-
-// find by primary key
-
-$user = $table->find(2);
-if($user !== false)
- print $user->name;
-
-// get all users
-foreach($table->findAll() as $user) {
- print $user->name;
-}
-
-// finding by dql
-foreach($table->findByDql("name LIKE '%John%'") as $user) {
- print $user->created;
-}
-
-// finding objects with DQL
-
-$users = $conn->query("FROM User WHERE User.name LIKE '%John%'");
-?>
diff --git a/manual/codes/Working with objects - Component overview - Record - Serializing.php b/manual/codes/Working with objects - Component overview - Record - Serializing.php
deleted file mode 100644
index 1ae2e9933..000000000
--- a/manual/codes/Working with objects - Component overview - Record - Serializing.php
+++ /dev/null
@@ -1,5 +0,0 @@
-
diff --git a/manual/codes/Working with objects - Component overview - Record - Updating records.php b/manual/codes/Working with objects - Component overview - Record - Updating records.php
deleted file mode 100644
index 217639483..000000000
--- a/manual/codes/Working with objects - Component overview - Record - Updating records.php
+++ /dev/null
@@ -1,12 +0,0 @@
-getTable("User");
-
-
-$user = $table->find(2);
-
-if($user !== false) {
- $user->name = "Jack Daniels";
-
- $user->save();
-}
-?>
diff --git a/manual/codes/Working with objects - Component overview - Table - Custom finders.php b/manual/codes/Working with objects - Component overview - Table - Custom finders.php
deleted file mode 100644
index 2301ca495..000000000
--- a/manual/codes/Working with objects - Component overview - Table - Custom finders.php
+++ /dev/null
@@ -1,24 +0,0 @@
-getConnection()->query("FROM User WHERE name LIKE '%$name%'");
- }
-}
-class User extends Doctrine_Record { }
-
-$conn = Doctrine_Manager::getInstance()
- ->openConnection(new PDO("dsn","username","password"));
-
-// doctrine will now check if a class called UserTable exists
-// and if it inherits Doctrine_Table
-
-$table = $conn->getTable("User");
-
-print get_class($table); // UserTable
-
-$users = $table->findByName("Jack");
-
-?>
diff --git a/manual/codes/Working with objects - Component overview - Table - Custom table classes.php b/manual/codes/Working with objects - Component overview - Table - Custom table classes.php
deleted file mode 100644
index 138d5a445..000000000
--- a/manual/codes/Working with objects - Component overview - Table - Custom table classes.php
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
diff --git a/manual/codes/Working with objects - Component overview - Table - Finder methods.php b/manual/codes/Working with objects - Component overview - Table - Finder methods.php
deleted file mode 100644
index 9b462c449..000000000
--- a/manual/codes/Working with objects - Component overview - Table - Finder methods.php
+++ /dev/null
@@ -1,21 +0,0 @@
-getTable("User");
-
-// find by primary key
-
-$user = $table->find(2);
-
-if($user !== false)
- print $user->name;
-
-
-// get all users
-foreach($table->findAll() as $user) {
- print $user->name;
-}
-
-// finding by dql
-foreach($table->findByDql("name LIKE '%John%'") as $user) {
- print $user->created;
-}
-?>
diff --git a/manual/codes/Working with objects - Component overview - Table - Getting relation objects.php b/manual/codes/Working with objects - Component overview - Table - Getting relation objects.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/Working with objects - Component overview - Table - Getting table information.php b/manual/codes/Working with objects - Component overview - Table - Getting table information.php
deleted file mode 100644
index 5a90872b1..000000000
--- a/manual/codes/Working with objects - Component overview - Table - Getting table information.php
+++ /dev/null
@@ -1,11 +0,0 @@
-getTable('User');
-
-// getting column names
-
-$names = $table->getColumnNames();
-
-// getting column information
-
-$columns = $table->getColumns();
-?>
diff --git a/manual/codes/Working with objects - Component overview - Table - Introduction.php b/manual/codes/Working with objects - Component overview - Table - Introduction.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/codes/Working with objects - Dealing with relations - Creating related records.php b/manual/codes/Working with objects - Dealing with relations - Creating related records.php
deleted file mode 100644
index edb3ab559..000000000
--- a/manual/codes/Working with objects - Dealing with relations - Creating related records.php
+++ /dev/null
@@ -1,14 +0,0 @@
-Email;
-
-$email->address = 'jackdaniels@drinkmore.info';
-
-$user->save();
-
-// alternative:
-
-$user->Email->address = 'jackdaniels@drinkmore.info';
-
-$user->save();
-?>
diff --git a/manual/codes/Working with objects - Dealing with relations - Deleting related records.php b/manual/codes/Working with objects - Dealing with relations - Deleting related records.php
deleted file mode 100644
index e936c3cff..000000000
--- a/manual/codes/Working with objects - Dealing with relations - Deleting related records.php
+++ /dev/null
@@ -1,9 +0,0 @@
-Email->delete();
-
-$user->Phonenumber[3]->delete();
-
-// deleting user and all related objects:
-
-$user->delete();
-?>
diff --git a/manual/codes/Working with objects - Dealing with relations - Retrieving related records.php b/manual/codes/Working with objects - Dealing with relations - Retrieving related records.php
deleted file mode 100644
index 0fe75cee5..000000000
--- a/manual/codes/Working with objects - Dealing with relations - Retrieving related records.php
+++ /dev/null
@@ -1,7 +0,0 @@
-Email['address'];
-
-print $user->Phonenumber[0]->phonenumber;
-
-print $user->Group[0]->name;
-?>
diff --git a/manual/codes/Working with objects - Dealing with relations - Updating related records.php b/manual/codes/Working with objects - Dealing with relations - Updating related records.php
deleted file mode 100644
index 66f928bdf..000000000
--- a/manual/codes/Working with objects - Dealing with relations - Updating related records.php
+++ /dev/null
@@ -1,9 +0,0 @@
-Email['address'] = 'koskenkorva@drinkmore.info';
-
-$user->Phonenumber[0]->phonenumber = '123123';
-
-$user->save();
-
-// saves the email and phonenumber
-?>
diff --git a/manual/codes/Working with objects - Dealing with relations - Working with associations.php b/manual/codes/Working with objects - Dealing with relations - Working with associations.php
deleted file mode 100644
index e69de29bb..000000000
diff --git a/manual/docs/Advanced components - Cache - Introduction.php b/manual/docs/Advanced components - Cache - Introduction.php
index e7abab911..2c302a479 100644
--- a/manual/docs/Advanced components - Cache - Introduction.php
+++ b/manual/docs/Advanced components - Cache - Introduction.php
@@ -1,2 +1,3 @@
Caching is one of the most influental things when it comes to performance tuning. Doctrine_Cache provides means for
caching queries and for managing the cached queries.
+
diff --git a/manual/docs/Advanced components - Cache - Query cache.php b/manual/docs/Advanced components - Cache - Query cache.php
index e69de29bb..8b1378917 100644
--- a/manual/docs/Advanced components - Cache - Query cache.php
+++ b/manual/docs/Advanced components - Cache - Query cache.php
@@ -0,0 +1 @@
+
diff --git a/manual/docs/Advanced components - Db_Profiler - Advanced usage.php b/manual/docs/Advanced components - Db_Profiler - Advanced usage.php
index e69de29bb..8b1378917 100644
--- a/manual/docs/Advanced components - Db_Profiler - Advanced usage.php
+++ b/manual/docs/Advanced components - Db_Profiler - Advanced usage.php
@@ -0,0 +1 @@
+
diff --git a/manual/docs/Advanced components - Db_Profiler - Basic usage.php b/manual/docs/Advanced components - Db_Profiler - Basic usage.php
index e69de29bb..8b1378917 100644
--- a/manual/docs/Advanced components - Db_Profiler - Basic usage.php
+++ b/manual/docs/Advanced components - Db_Profiler - Basic usage.php
@@ -0,0 +1 @@
+
diff --git a/manual/docs/Advanced components - Db_Profiler - Introduction.php b/manual/docs/Advanced components - Db_Profiler - Introduction.php
index 83bd47179..fdf942647 100644
--- a/manual/docs/Advanced components - Db_Profiler - Introduction.php
+++ b/manual/docs/Advanced components - Db_Profiler - Introduction.php
@@ -10,3 +10,4 @@ renderCode("");
?>
+
diff --git a/manual/docs/Advanced components - Evenlisteners - AccessorInvoker.php b/manual/docs/Advanced components - Evenlisteners - AccessorInvoker.php
index d3f5a12fa..6ae287d87 100644
--- a/manual/docs/Advanced components - Evenlisteners - AccessorInvoker.php
+++ b/manual/docs/Advanced components - Evenlisteners - AccessorInvoker.php
@@ -1 +1,34 @@
+
+
+class User {
+ public function setTableDefinition() {
+ $this->hasColumn("name", "string", 200);
+ $this->hasColumn("password", "string", 32);
+ }
+ public function setPassword($password) {
+ return md5($password);
+ }
+ public function getName($name) {
+ return strtoupper($name);
+ }
+}
+
+$user = new User();
+
+$user->name = 'someone';
+
+print $user->name; // someone
+
+$user->password = '123';
+
+print $user->password; // 123
+
+$user->setAttribute(Doctrine::ATTR_LISTENER, new Doctrine_EventListener_AccessorInvoker());
+
+print $user->name; // SOMEONE
+
+$user->password = '123';
+
+print $user->password; // 202cb962ac59075b964b07152d234b70
+
diff --git a/manual/docs/Advanced components - Eventlisteners - AccessorInvoker.php b/manual/docs/Advanced components - Eventlisteners - AccessorInvoker.php
index e69de29bb..8b1378917 100644
--- a/manual/docs/Advanced components - Eventlisteners - AccessorInvoker.php
+++ b/manual/docs/Advanced components - Eventlisteners - AccessorInvoker.php
@@ -0,0 +1 @@
+
diff --git a/manual/docs/Advanced components - Eventlisteners - Chaining.php b/manual/docs/Advanced components - Eventlisteners - Chaining.php
index e69de29bb..8b1378917 100644
--- a/manual/docs/Advanced components - Eventlisteners - Chaining.php
+++ b/manual/docs/Advanced components - Eventlisteners - Chaining.php
@@ -0,0 +1 @@
+
diff --git a/manual/docs/Advanced components - Eventlisteners - Creating a logger.php b/manual/docs/Advanced components - Eventlisteners - Creating a logger.php
index e69de29bb..8b1378917 100644
--- a/manual/docs/Advanced components - Eventlisteners - Creating a logger.php
+++ b/manual/docs/Advanced components - Eventlisteners - Creating a logger.php
@@ -0,0 +1 @@
+
diff --git a/manual/docs/Advanced components - Eventlisteners - Creating new listener.php b/manual/docs/Advanced components - Eventlisteners - Creating new listener.php
index 1137b8917..da9bec4b7 100644
--- a/manual/docs/Advanced components - Eventlisteners - Creating new listener.php
+++ b/manual/docs/Advanced components - Eventlisteners - Creating new listener.php
@@ -1 +1,36 @@
Creating a new listener is very easy. You can set the listener in global, connection or factory level.
+
+
+class MyListener extends Doctrine_EventListener {
+ public function onLoad(Doctrine_Record $record) {
+ print $record->getTable()->getComponentName()." just got loaded!";
+ }
+ public function onSave(Doctrine_Record $record) {
+ print "saved data access object!";
+ }
+}
+class MyListener2 extends Doctrine_EventListener {
+ public function onPreUpdate() {
+ try {
+ $record->set("updated",time());
+ } catch(InvalidKeyException $e) {
+ }
+ }
+}
+
+
+// setting global listener
+$manager = Doctrine_Manager::getInstance();
+
+$manager->setAttribute(Doctrine::ATTR_LISTENER,new MyListener());
+
+// setting connection level listener
+$conn = $manager->openConnection($dbh);
+
+$conn->setAttribute(Doctrine::ATTR_LISTENER,new MyListener2());
+
+// setting factory level listener
+$table = $conn->getTable("User");
+
+$table->setAttribute(Doctrine::ATTR_LISTENER,new MyListener());
+
diff --git a/manual/docs/Advanced components - Eventlisteners - Introduction.php b/manual/docs/Advanced components - Eventlisteners - Introduction.php
index e69de29bb..8b1378917 100644
--- a/manual/docs/Advanced components - Eventlisteners - Introduction.php
+++ b/manual/docs/Advanced components - Eventlisteners - Introduction.php
@@ -0,0 +1 @@
+
diff --git a/manual/docs/Advanced components - Eventlisteners - List of events.php b/manual/docs/Advanced components - Eventlisteners - List of events.php
index 95524cd93..3ef2d9f29 100644
--- a/manual/docs/Advanced components - Eventlisteners - List of events.php
+++ b/manual/docs/Advanced components - Eventlisteners - List of events.php
@@ -1 +1,47 @@
Here is a list of availible events and their parameters:
+
+
+interface Doctrine_EventListener_Interface {
+
+ public function onLoad(Doctrine_Record $record);
+ public function onPreLoad(Doctrine_Record $record);
+
+ public function onUpdate(Doctrine_Record $record);
+ public function onPreUpdate(Doctrine_Record $record);
+
+ public function onCreate(Doctrine_Record $record);
+ public function onPreCreate(Doctrine_Record $record);
+
+ public function onSave(Doctrine_Record $record);
+ public function onPreSave(Doctrine_Record $record);
+
+ public function onInsert(Doctrine_Record $record);
+ public function onPreInsert(Doctrine_Record $record);
+
+ public function onDelete(Doctrine_Record $record);
+ public function onPreDelete(Doctrine_Record $record);
+
+ public function onEvict(Doctrine_Record $record);
+ public function onPreEvict(Doctrine_Record $record);
+
+ public function onSleep(Doctrine_Record $record);
+
+ public function onWakeUp(Doctrine_Record $record);
+
+ public function onClose(Doctrine_Connection $connection);
+ public function onPreClose(Doctrine_Connection $connection);
+
+ public function onOpen(Doctrine_Connection $connection);
+
+ public function onTransactionCommit(Doctrine_Connection $connection);
+ public function onPreTransactionCommit(Doctrine_Connection $connection);
+
+ public function onTransactionRollback(Doctrine_Connection $connection);
+ public function onPreTransactionRollback(Doctrine_Connection $connection);
+
+ public function onTransactionBegin(Doctrine_Connection $connection);
+ public function onPreTransactionBegin(Doctrine_Connection $connection);
+
+ public function onCollectionDelete(Doctrine_Collection $collection);
+ public function onPreCollectionDelete(Doctrine_Collection $collection);
+}
diff --git a/manual/docs/Advanced components - Eventlisteners - Listening events.php b/manual/docs/Advanced components - Eventlisteners - Listening events.php
index e69de29bb..be619e48b 100644
--- a/manual/docs/Advanced components - Eventlisteners - Listening events.php
+++ b/manual/docs/Advanced components - Eventlisteners - Listening events.php
@@ -0,0 +1,14 @@
+
+
diff --git a/manual/docs/Advanced components - Locking Manager - Examples.php b/manual/docs/Advanced components - Locking Manager - Examples.php
index fe02a525e..44ccf1903 100644
--- a/manual/docs/Advanced components - Locking Manager - Examples.php
+++ b/manual/docs/Advanced components - Locking Manager - Examples.php
@@ -1 +1,63 @@
The following code snippet demonstrates the use of Doctrine's pessimistic offline locking capabilities.
+
+At the page where the lock is requested...
+
+$table = $conn->getTable("User");
+
+$table->setEventListener(new MyListener2());
+
+// retrieve user whose primary key is 2
+$user = $table->find(2);
+
+$user->name = "John Locke";
+
+// update event will be listened and current time will be assigned to the field 'updated'
+$user->save();
+
diff --git a/manual/docs/Advanced components - Hook - Building queries.php b/manual/docs/Advanced components - Hook - Building queries.php
index e69de29bb..8b1378917 100644
--- a/manual/docs/Advanced components - Hook - Building queries.php
+++ b/manual/docs/Advanced components - Hook - Building queries.php
@@ -0,0 +1 @@
+
diff --git a/manual/docs/Advanced components - Hook - Introduction.php b/manual/docs/Advanced components - Hook - Introduction.php
index f5e977f91..b6f9a4314 100644
--- a/manual/docs/Advanced components - Hook - Introduction.php
+++ b/manual/docs/Advanced components - Hook - Introduction.php
@@ -1,3 +1,4 @@
Many web applications have different kinds of lists. The lists may contain data from multiple components (= database tables) and
they may have actions such as paging, sorting and setting conditions. Doctrine_Hook helps building these lists. It has a simple API for
building search criteria forms as well as building a DQL query from the 'hooked' parameters.
+
diff --git a/manual/docs/Advanced components - Hook - List of parsers.php b/manual/docs/Advanced components - Hook - List of parsers.php
index e69de29bb..8b1378917 100644
--- a/manual/docs/Advanced components - Hook - List of parsers.php
+++ b/manual/docs/Advanced components - Hook - List of parsers.php
@@ -0,0 +1 @@
+
diff --git a/manual/codes/Advanced components - Hook - Parameter hooking.php b/manual/docs/Advanced components - Hook - Parameter hooking.php
similarity index 59%
rename from manual/codes/Advanced components - Hook - Parameter hooking.php
rename to manual/docs/Advanced components - Hook - Parameter hooking.php
index 44eb80df5..c899f011d 100644
--- a/manual/codes/Advanced components - Hook - Parameter hooking.php
+++ b/manual/docs/Advanced components - Hook - Parameter hooking.php
@@ -1,3 +1,4 @@
-
$hook = new Doctrine_Hook($table, $fields);
-?>
+
+
+// Get a locking manager instance
+$lockingMngr = new Doctrine_Locking_Manager_Pessimistic();
+
+try
+{
+ // Ensure that old locks which timed out are released
+ // before we try to acquire our lock
+ // 300 seconds = 5 minutes timeout
+ $lockingMngr->releaseAgedLocks(300);
+
+ // Try to get the lock on a record
+ $gotLock = $lockingMngr->getLock(
+ // The record to lock. This can be any Doctrine_Record
+ $myRecordToLock,
+ // The unique identifier of the user who is trying to get the lock
+ 'Bart Simpson'
+ );
+
+ if($gotLock)
+ {
+ echo "Got lock!";
+ // ... proceed
+ }
+ else
+ {
+ echo "Sorry, someone else is currently working on this record";
+ }
+}
+catch(Doctrine_Locking_Exception $dle)
+{
+ echo $dle->getMessage();
+ // handle the error
+}
+
+
+
+At the page where the transaction finishes...
+
+// Get a locking manager instance
+$lockingMngr = new Doctrine_Locking_Manager_Pessimistic();
+
+try
+{
+ if($lockingMngr->releaseLock($myRecordToUnlock, 'Bart Simpson'))
+ {
+ echo "Lock released";
+ }
+ else
+ {
+ echo "Record was not locked. No locks released.";
+ }
+}
+catch(Doctrine_Locking_Exception $dle)
+{
+ echo $dle->getMessage();
+ // handle the error
+}
+
diff --git a/manual/docs/Advanced components - Locking Manager - Introduction.php b/manual/docs/Advanced components - Locking Manager - Introduction.php
index 52833e691..99f934c75 100644
--- a/manual/docs/Advanced components - Locking Manager - Introduction.php
+++ b/manual/docs/Advanced components - Locking Manager - Introduction.php
@@ -21,3 +21,4 @@ noone else modifies the same objects until he has finished his work.
Doctrine's pessimistic offline locking capabilities can be used to control concurrency during actions or procedures
that take several HTTP request and response cycles and/or a lot of time to complete.
+
diff --git a/manual/docs/Advanced components - Locking Manager - Maintainer.php b/manual/docs/Advanced components - Locking Manager - Maintainer.php
index 9934f77d7..9d242f34e 100644
--- a/manual/docs/Advanced components - Locking Manager - Maintainer.php
+++ b/manual/docs/Advanced components - Locking Manager - Maintainer.php
@@ -1,2 +1,2 @@
Roman Borschel - romanb at #doctrine (freenode)
-Don't hesitate to contact me if you have questions, ideas, ect.
\ No newline at end of file
+Don't hesitate to contact me if you have questions, ideas, ect.
diff --git a/manual/docs/Advanced components - Locking Manager - Planned.php b/manual/docs/Advanced components - Locking Manager - Planned.php
index 42ce24c57..d995f70bb 100644
--- a/manual/docs/Advanced components - Locking Manager - Planned.php
+++ b/manual/docs/Advanced components - Locking Manager - Planned.php
@@ -1,2 +1,2 @@
- Possibility to release locks of a specific Record type (i.e. releasing all locks on 'User'
-objects).
\ No newline at end of file
+objects).
diff --git a/manual/docs/Advanced components - Locking Manager - Technical Details.php b/manual/docs/Advanced components - Locking Manager - Technical Details.php
index 7a4a56aca..57efaa9fe 100644
--- a/manual/docs/Advanced components - Locking Manager - Technical Details.php
+++ b/manual/docs/Advanced components - Locking Manager - Technical Details.php
@@ -3,3 +3,4 @@ The required locking table is automatically created when you try to instantiate
of the manager and the ATTR_CREATE_TABLES is set to TRUE.
This behaviour may change in the future to provide a centralised and consistent table creation
procedure for installation purposes.
+
diff --git a/manual/docs/Advanced components - Validators - Introduction.php b/manual/docs/Advanced components - Validators - Introduction.php
index ef9d61bd2..6be899668 100644
--- a/manual/docs/Advanced components - Validators - Introduction.php
+++ b/manual/docs/Advanced components - Validators - Introduction.php
@@ -15,3 +15,9 @@ are both valid integers whilst "3f" is not. Type validations occur on every colu
column definition needs a type).
- Length validation: As the name implies, all values assigned to columns are validated to make
sure that the value does not exceed the maximum length.
+
+
+// turning on validation
+
+Doctrine_Manager::getInstance()->setAttribute(Doctrine::ATTR_VLD, true);
+
diff --git a/manual/docs/Advanced components - Validators - List of predefined validators.php b/manual/docs/Advanced components - Validators - List of predefined validators.php
index 52227c216..af30adc69 100644
--- a/manual/docs/Advanced components - Validators - List of predefined validators.php
+++ b/manual/docs/Advanced components - Validators - List of predefined validators.php
@@ -11,3 +11,4 @@ Here is a list of predefined validators. You cannot use these names for your cus
|| range || [min,max] || Checks if value is in range specified by arguments.||
|| unique || || Checks if value is unique in its database table. ||
|| regexp || [expression] || Check if valie matches a given regexp. ||
+
diff --git a/manual/docs/Advanced components - Validators - More Validation.php b/manual/docs/Advanced components - Validators - More Validation.php
index d44722616..fa2783c1f 100644
--- a/manual/docs/Advanced components - Validators - More Validation.php
+++ b/manual/docs/Advanced components - Validators - More Validation.php
@@ -26,3 +26,32 @@ Within thess methods you can use all the power of PHP to validate your fields. W
doesnt pass your validation you can then add errors to the record's error stack.
The following code snippet shows an example of how to define validators together with custom
validation:
+
+
+class User extends Doctrine_Record {
+ public function setUp() {
+ $this->ownsOne("Email","User.email_id");
+ }
+ public function setTableDefinition() {
+ // no special validators used only types
+ // and lengths will be validated
+ $this->hasColumn("name","string",15);
+ $this->hasColumn("email_id","integer");
+ $this->hasColumn("created","integer",11);
+ }
+ // Our own validation
+ protected function validate() {
+ if ($this->name == 'God') {
+ // Blasphemy! Stop that! ;-)
+ // syntax: add(
diff --git a/manual/docs/Advanced components - Validators - Valid or Not Valid.php b/manual/docs/Advanced components - Validators - Valid or Not Valid.php
index 6478020eb..4b08396e8 100644
--- a/manual/docs/Advanced components - Validators - Valid or Not Valid.php
+++ b/manual/docs/Advanced components - Validators - Valid or Not Valid.php
@@ -20,3 +20,34 @@ way as seen above except that no exception is thrown, so you simply obtain
the error stack of the record that didnt pass validation through Doctrine_Record::getErrorStack().
The following code snippet shows an example of handling implicit validation which caused a Doctrine_Validator_Exception.
+
+
+try {
+ $user->name = "this is an example of too long name";
+ $user->Email->address = "drink@@notvalid..";
+ $user->save();
+} catch(Doctrine_Validator_Exception $e) {
+ // Note: you could also use $e->getInvalidRecords(). The direct way
+ // used here is just more simple when you know the records you're dealing with.
+ $userErrors = $user->getErrorStack();
+ $emailErrors = $user->Email->getErrorStack();
+
+ /* Inspect user errors */
+ foreach($userErrors as $fieldName => $errorCodes) {
+ switch ($fieldName) {
+ case 'name':
+ // $user->name is invalid. inspect the error codes if needed.
+ break;
+ }
+ }
+
+ /* Inspect email errors */
+ foreach($emailErrors as $fieldName => $errorCodes) {
+ switch ($fieldName) {
+ case 'address':
+ // $user->Email->address is invalid. inspect the error codes if needed.
+ break;
+ }
+ }
+}
+
diff --git a/manual/docs/Advanced components - View - Intoduction.php b/manual/docs/Advanced components - View - Intoduction.php
index 8ca580f33..da4e96544 100644
--- a/manual/docs/Advanced components - View - Intoduction.php
+++ b/manual/docs/Advanced components - View - Intoduction.php
@@ -1,2 +1,3 @@
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.
+
diff --git a/manual/docs/Advanced components - View - Managing views.php b/manual/docs/Advanced components - View - Managing views.php
index e69de29bb..f9e0d5359 100644
--- a/manual/docs/Advanced components - View - Managing views.php
+++ b/manual/docs/Advanced components - View - Managing views.php
@@ -0,0 +1,16 @@
+
+
+$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();
+
diff --git a/manual/docs/Advanced components - View - Using views.php b/manual/docs/Advanced components - View - Using views.php
index d3f5a12fa..346a45435 100644
--- a/manual/docs/Advanced components - View - Using views.php
+++ b/manual/docs/Advanced components - View - Using views.php
@@ -1 +1,15 @@
+
+
+$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();
+
diff --git a/manual/docs/Coding standards - Coding Style - Arrays.php b/manual/docs/Coding standards - Coding Style - Arrays.php
index 4eafdf10b..e41f40962 100644
--- a/manual/docs/Coding standards - Coding Style - Arrays.php
+++ b/manual/docs/Coding standards - Coding Style - Arrays.php
@@ -13,3 +13,16 @@
+
+
+$sampleArray = array('Doctrine', 'ORM', 1, 2, 3);
+
+
+$sampleArray = array(1, 2, 3,
+ $a, $b, $c,
+ 56.44, $d, 500);
+
+
+$sampleArray = array('first' => 'firstValue',
+ 'second' => 'secondValue');
+
diff --git a/manual/docs/Coding standards - Coding Style - Classes.php b/manual/docs/Coding standards - Coding Style - Classes.php
index 6951fc07e..61c93a9df 100644
--- a/manual/docs/Coding standards - Coding Style - Classes.php
+++ b/manual/docs/Coding standards - Coding Style - Classes.php
@@ -19,3 +19,12 @@
This is an example of an acceptable class declaration:
+
+
diff --git a/manual/codes/Configuration - Setting default fetchmode.php b/manual/docs/Configuration - Setting default fetchmode.php
similarity index 89%
rename from manual/codes/Configuration - Setting default fetchmode.php
rename to manual/docs/Configuration - Setting default fetchmode.php
index bee2e999c..dbb0d02a4 100644
--- a/manual/codes/Configuration - Setting default fetchmode.php
+++ b/manual/docs/Configuration - Setting default fetchmode.php
@@ -1,4 +1,5 @@
-
// setting default fetchmode
// availible fetchmodes are Doctrine::FETCH_LAZY, Doctrine::FETCH_IMMEDIATE and Doctrine::FETCH_BATCH
// the default fetchmode is Doctrine::FETCH_LAZY
@@ -8,4 +9,4 @@ class Address extends Doctrine_Record {
$this->setAttribute(Doctrine::ATTR_FETCHMODE,Doctrine::FETCH_IMMEDIATE);
}
}
-?>
+
diff --git a/manual/codes/Configuration - Using sequences.php b/manual/docs/Configuration - Using sequences.php
similarity index 79%
rename from manual/codes/Configuration - Using sequences.php
rename to manual/docs/Configuration - Using sequences.php
index 16ed99419..87efa219c 100644
--- a/manual/codes/Configuration - Using sequences.php
+++ b/manual/docs/Configuration - Using sequences.php
@@ -1,4 +1,5 @@
-
// using sequences
class User extends Doctrine_Record {
@@ -6,4 +7,4 @@ class User extends Doctrine_Record {
$this->setSequenceName("user_seq");
}
}
-?>
+
diff --git a/manual/docs/Connection management - Connection-component binding.php b/manual/docs/Connection management - Connection-component binding.php
index fd4fbfdcd..5ac935b34 100644
--- a/manual/docs/Connection management - Connection-component binding.php
+++ b/manual/docs/Connection management - Connection-component binding.php
@@ -21,3 +21,4 @@ renderCode("from('Group g')->where('g.id IN (1,2,3)')->execute();
?>");
?>
+
diff --git a/manual/docs/Connection management - Lazy-connecting to database.php b/manual/docs/Connection management - Lazy-connecting to database.php
index 44646ea6b..83e291aae 100644
--- a/manual/docs/Connection management - Lazy-connecting to database.php
+++ b/manual/docs/Connection management - Lazy-connecting to database.php
@@ -19,3 +19,4 @@ renderCode("");
?>
+
diff --git a/manual/docs/Connection management - Managing connections.php b/manual/docs/Connection management - Managing connections.php
index 4279c5c3b..d33f95112 100644
--- a/manual/docs/Connection management - Managing connections.php
+++ b/manual/docs/Connection management - Managing connections.php
@@ -69,3 +69,4 @@ foreach(\$manager as \$conn) {
}
?>");
?>
+
diff --git a/manual/docs/Connection management - Opening a new connection.php b/manual/docs/Connection management - Opening a new connection.php
index 0b6dffa9d..cec6c99d2 100644
--- a/manual/docs/Connection management - Opening a new connection.php
+++ b/manual/docs/Connection management - Opening a new connection.php
@@ -38,3 +38,4 @@ renderCode("");
?>
+
diff --git a/manual/docs/Connection modules - DataDict - Getting database declaration.php b/manual/docs/Connection modules - DataDict - Getting database declaration.php
index e69de29bb..8b1378917 100644
--- a/manual/docs/Connection modules - DataDict - Getting database declaration.php
+++ b/manual/docs/Connection modules - DataDict - Getting database declaration.php
@@ -0,0 +1 @@
+
diff --git a/manual/docs/Connection modules - DataDict - Getting portable type.php b/manual/docs/Connection modules - DataDict - Getting portable type.php
index e69de29bb..8b1378917 100644
--- a/manual/docs/Connection modules - DataDict - Getting portable type.php
+++ b/manual/docs/Connection modules - DataDict - Getting portable type.php
@@ -0,0 +1 @@
+
diff --git a/manual/docs/Connection modules - DataDict - Reserved keywords.php b/manual/docs/Connection modules - DataDict - Reserved keywords.php
index e69de29bb..8b1378917 100644
--- a/manual/docs/Connection modules - DataDict - Reserved keywords.php
+++ b/manual/docs/Connection modules - DataDict - Reserved keywords.php
@@ -0,0 +1 @@
+
diff --git a/manual/docs/Connection modules - Export - Altering table.php b/manual/docs/Connection modules - Export - Altering table.php
index d79aa70c1..814b3e683 100644
--- a/manual/docs/Connection modules - Export - Altering table.php
+++ b/manual/docs/Connection modules - Export - Altering table.php
@@ -53,3 +53,43 @@ Associative array with the names of the fields to be changed as indexes of the a
The value of each entry of the array should be set to another associative array with the properties of the fields to that are meant to be changed as array entries. These entries should be assigned to the new values of the respective properties. The properties of the fields should be the same as defined by the Doctrine parser.
+
+
+/**
+ * Documentation here
+ */
+class Doctrine_SampleClass {
+ // entire content of class
+ // must be indented four spaces
+}
diff --git a/manual/docs/Coding standards - Coding Style - Control statements.php b/manual/docs/Coding standards - Coding Style - Control statements.php
index 164cea7b9..408e80089 100644
--- a/manual/docs/Coding standards - Coding Style - Control statements.php
+++ b/manual/docs/Coding standards - Coding Style - Control statements.php
@@ -73,3 +73,4 @@ switch (\$case) {
diff --git a/manual/docs/Configuration - Introduction.php b/manual/docs/Configuration - Introduction.php
index e69de29bb..32726fecb 100644
--- a/manual/docs/Configuration - Introduction.php
+++ b/manual/docs/Configuration - Introduction.php
@@ -0,0 +1,6 @@
+
+
+
diff --git a/manual/docs/Coding standards - Coding Style - Functions and methods.php b/manual/docs/Coding standards - Coding Style - Functions and methods.php
index 32aabcb2e..a7f8b0d94 100644
--- a/manual/docs/Coding standards - Coding Style - Functions and methods.php
+++ b/manual/docs/Coding standards - Coding Style - Functions and methods.php
@@ -97,3 +97,4 @@ threeArguments(array(1, 2, 3, 'Framework',
?>");
?>
+
diff --git a/manual/docs/Coding standards - Coding Style - Inline documentation.php b/manual/docs/Coding standards - Coding Style - Inline documentation.php
index ee680961f..cb02c60a4 100644
--- a/manual/docs/Coding standards - Coding Style - Inline documentation.php
+++ b/manual/docs/Coding standards - Coding Style - Inline documentation.php
@@ -33,3 +33,4 @@ Methods:
+
diff --git a/manual/docs/Coding standards - Coding Style - PHP code demarcation.php b/manual/docs/Coding standards - Coding Style - PHP code demarcation.php
index 673505441..0a66ad8ba 100644
--- a/manual/docs/Coding standards - Coding Style - PHP code demarcation.php
+++ b/manual/docs/Coding standards - Coding Style - PHP code demarcation.php
@@ -2,3 +2,4 @@ PHP code must always be delimited by the full-form, standard PHP tags ()
Short tags are never allowed. For files containing only PHP code, the closing tag must always be omitted
+
diff --git a/manual/docs/Coding standards - Coding Style - Strings.php b/manual/docs/Coding standards - Coding Style - Strings.php
index bb016d70d..86fe80046 100644
--- a/manual/docs/Coding standards - Coding Style - Strings.php
+++ b/manual/docs/Coding standards - Coding Style - Strings.php
@@ -16,3 +16,22 @@
+// literal string
+$string = 'something';
+
+// string contains apostrophes
+$sql = "SELECT id, name FROM people WHERE name = 'Fred' OR name = 'Susan'";
+
+// variable substitution
+$greeting = "Hello $name, welcome back!";
+
+// concatenation
+$framework = 'Doctrine' . ' ORM ' . 'Framework';
+
+// concatenation line breaking
+
+$sql = "SELECT id, name FROM user "
+ . "WHERE name = ? "
+ . "ORDER BY name ASC";
diff --git a/manual/docs/Coding standards - Naming Conventions - Classes.php b/manual/docs/Coding standards - Naming Conventions - Classes.php
index 88aa837ee..e20a3f674 100644
--- a/manual/docs/Coding standards - Naming Conventions - Classes.php
+++ b/manual/docs/Coding standards - Naming Conventions - Classes.php
@@ -11,3 +11,4 @@ Underscores are only permitted in place of the path separator, eg. the filename
diff --git a/manual/codes/Configuration - Custom primary key column.php b/manual/docs/Configuration - Custom primary key column.php
similarity index 81%
rename from manual/codes/Configuration - Custom primary key column.php
rename to manual/docs/Configuration - Custom primary key column.php
index 1535df124..b5b1d3fc5 100644
--- a/manual/codes/Configuration - Custom primary key column.php
+++ b/manual/docs/Configuration - Custom primary key column.php
@@ -1,4 +1,5 @@
-
// custom primary key column name
class Group extends Doctrine_Record {
@@ -6,4 +7,4 @@ class Group extends Doctrine_Record {
$this->setPrimaryKeyColumn("group_id");
}
}
-?>
+
+
+
+class Doctrine_SomeClass {
+ const MY_CONSTANT = 'something';
+}
+print Doctrine_SomeClass::MY_CONSTANT;
+
diff --git a/manual/docs/Coding standards - Naming Conventions - Filenames.php b/manual/docs/Coding standards - Naming Conventions - Filenames.php
index 7dbebdd9c..b5a2a11f3 100644
--- a/manual/docs/Coding standards - Naming Conventions - Filenames.php
+++ b/manual/docs/Coding standards - Naming Conventions - Filenames.php
@@ -12,3 +12,4 @@ Doctrine/Connection/Transaction.php
+
diff --git a/manual/docs/Coding standards - Naming Conventions - Functions and methods.php b/manual/docs/Coding standards - Naming Conventions - Functions and methods.php
index 5511f1b7f..94399901e 100644
--- a/manual/docs/Coding standards - Naming Conventions - Functions and methods.php
+++ b/manual/docs/Coding standards - Naming Conventions - Functions and methods.php
@@ -18,3 +18,4 @@ for this is that since all user defined ActiveRecords inherit Doctrine_Record, i
+
diff --git a/manual/docs/Coding standards - Naming Conventions - Interfaces.php b/manual/docs/Coding standards - Naming Conventions - Interfaces.php
index 173f59c13..847b0274e 100644
--- a/manual/docs/Coding standards - Naming Conventions - Interfaces.php
+++ b/manual/docs/Coding standards - Naming Conventions - Interfaces.php
@@ -7,3 +7,4 @@ Doctrine_Db_EventListener_Interface
Doctrine_EventListener_Interface
+
diff --git a/manual/docs/Coding standards - Naming Conventions - Record columns.php b/manual/docs/Coding standards - Naming Conventions - Record columns.php
index e69de29bb..8b1378917 100644
--- a/manual/docs/Coding standards - Naming Conventions - Record columns.php
+++ b/manual/docs/Coding standards - Naming Conventions - Record columns.php
@@ -0,0 +1 @@
+
diff --git a/manual/docs/Coding standards - Naming Conventions - Variables.php b/manual/docs/Coding standards - Naming Conventions - Variables.php
index bbf3094b2..54b280794 100644
--- a/manual/docs/Coding standards - Naming Conventions - Variables.php
+++ b/manual/docs/Coding standards - Naming Conventions - Variables.php
@@ -26,3 +26,5 @@ All variables must satisfy the following conditions:
There are cases when more descriptive names are more appropriate (for example when multiple objects of the same class are used in same context),
in that case it is allowed to use different names than the ones mentioned.
+
+
diff --git a/manual/docs/Coding standards - Overview - Goals.php b/manual/docs/Coding standards - Overview - Goals.php
index e69de29bb..8b1378917 100644
--- a/manual/docs/Coding standards - Overview - Goals.php
+++ b/manual/docs/Coding standards - Overview - Goals.php
@@ -0,0 +1 @@
+
diff --git a/manual/docs/Coding standards - Overview - Scope.php b/manual/docs/Coding standards - Overview - Scope.php
index e69de29bb..8b1378917 100644
--- a/manual/docs/Coding standards - Overview - Scope.php
+++ b/manual/docs/Coding standards - Overview - Scope.php
@@ -0,0 +1 @@
+
diff --git a/manual/docs/Coding standards - PHP File Formatting - General.php b/manual/docs/Coding standards - PHP File Formatting - General.php
index 168fb64f7..73d61f660 100644
--- a/manual/docs/Coding standards - PHP File Formatting - General.php
+++ b/manual/docs/Coding standards - PHP File Formatting - General.php
@@ -2,3 +2,4 @@ For files that contain only PHP code, the closing tag ("?>") is never permitted.
IMPORTANT: Inclusion of arbitrary binary data as permitted by __HALT_COMPILER() is prohibited from any Doctrine framework PHP file or files derived from them. Use of this feature is only permitted for special installation scripts.
+
diff --git a/manual/docs/Coding standards - PHP File Formatting - Indentation.php b/manual/docs/Coding standards - PHP File Formatting - Indentation.php
index dcc2bc522..9e8070543 100644
--- a/manual/docs/Coding standards - PHP File Formatting - Indentation.php
+++ b/manual/docs/Coding standards - PHP File Formatting - Indentation.php
@@ -1 +1,2 @@
Use an indent of 4 spaces, with no tabs.
+
diff --git a/manual/docs/Coding standards - PHP File Formatting - Line termination.php b/manual/docs/Coding standards - PHP File Formatting - Line termination.php
index b0a8fdda3..d13c8fa17 100644
--- a/manual/docs/Coding standards - PHP File Formatting - Line termination.php
+++ b/manual/docs/Coding standards - PHP File Formatting - Line termination.php
@@ -7,3 +7,5 @@
+
+
diff --git a/manual/docs/Coding standards - PHP File Formatting - Maximum line length.php b/manual/docs/Coding standards - PHP File Formatting - Maximum line length.php
index 390c03d59..a8a34b421 100644
--- a/manual/docs/Coding standards - PHP File Formatting - Maximum line length.php
+++ b/manual/docs/Coding standards - PHP File Formatting - Maximum line length.php
@@ -1 +1,2 @@
The target line length is 80 characters, i.e. developers should aim keep code as close to the 80-column boundary as is practical. However, longer lines are acceptable. The maximum length of any line of PHP code is 120 characters.
+
diff --git a/manual/docs/Coding standards - Testing - Writing tests.php b/manual/docs/Coding standards - Testing - Writing tests.php
index 9b683ab39..6823a464b 100644
--- a/manual/docs/Coding standards - Testing - Writing tests.php
+++ b/manual/docs/Coding standards - Testing - Writing tests.php
@@ -31,3 +31,4 @@ divide the method into smaller methods.
ASSERTIONS
+$manager = Doctrine_Manager::getInstance();
+
+$manager->setAttribute(Doctrine::ATTR_LISTENER, new MyListener());
+
diff --git a/manual/docs/Configuration - Levels of configuration.php b/manual/docs/Configuration - Levels of configuration.php
index bead615b7..7fee77891 100644
--- a/manual/docs/Configuration - Levels of configuration.php
+++ b/manual/docs/Configuration - Levels of configuration.php
@@ -16,3 +16,24 @@ the lazy fetching strategy will be used whenever the records of 'example' table
The attributes set in table level will take effect only on that table.
+
+
+// setting a global level attribute
+$manager = Doctrine_Manager::getInstance();
+
+$manager->setAttribute(Doctrine::ATTR_VLD, false);
+
+// setting a connection level attribute
+// (overrides the global level attribute on this connection)
+
+$conn = $manager->openConnection(new PDO('dsn', 'username', 'pw'));
+
+$conn->setAttribute(Doctrine::ATTR_VLD, true);
+
+// setting a table level attribute
+// (overrides the connection/global level attribute on this table)
+
+$table = $conn->getTable('User');
+
+$table->setAttribute(Doctrine::ATTR_LISTENER, new UserListener());
+
diff --git a/manual/docs/Configuration - Setting attributes - Batch size.php b/manual/docs/Configuration - Setting attributes - Batch size.php
index e69de29bb..077117e6f 100644
--- a/manual/docs/Configuration - Setting attributes - Batch size.php
+++ b/manual/docs/Configuration - Setting attributes - Batch size.php
@@ -0,0 +1,6 @@
+
+
+// setting default batch size for batch collections
+
+$manager->setAttribute(Doctrine::ATTR_BATCH_SIZE, 7);
+
diff --git a/manual/docs/Configuration - Setting attributes - Event listener.php b/manual/docs/Configuration - Setting attributes - Event listener.php
index e69de29bb..d1652dd56 100644
--- a/manual/docs/Configuration - Setting attributes - Event listener.php
+++ b/manual/docs/Configuration - Setting attributes - Event listener.php
@@ -0,0 +1,6 @@
+
+
+// setting default event listener
+
+$manager->setAttribute(Doctrine::ATTR_LISTENER, new MyListener());
+
diff --git a/manual/docs/Configuration - Setting attributes - Fetching strategy.php b/manual/docs/Configuration - Setting attributes - Fetching strategy.php
index e69de29bb..70dc56c8b 100644
--- a/manual/docs/Configuration - Setting attributes - Fetching strategy.php
+++ b/manual/docs/Configuration - Setting attributes - Fetching strategy.php
@@ -0,0 +1,6 @@
+
+
+// sets the default collection type (fetching strategy)
+
+$manager->setAttribute(Doctrine::ATTR_FETCHMODE, Doctrine::FETCH_LAZY);
+
diff --git a/manual/docs/Configuration - Setting attributes - Identifier quoting.php b/manual/docs/Configuration - Setting attributes - Identifier quoting.php
index 8f1eb1ae4..9422007c1 100644
--- a/manual/docs/Configuration - Setting attributes - Identifier quoting.php
+++ b/manual/docs/Configuration - Setting attributes - Identifier quoting.php
@@ -48,3 +48,4 @@ will result in a SQL statement that all the field names are quoted with the back
as opposed to:
+// sets the default offset collection limit
+
+$manager->setAttribute(Doctrine::ATTR_COLL_LIMIT, 10);
+
diff --git a/manual/docs/Configuration - Setting attributes - Portability.php b/manual/docs/Configuration - Setting attributes - Portability.php
index 75e7976f9..d1591e677 100644
--- a/manual/docs/Configuration - Setting attributes - Portability.php
+++ b/manual/docs/Configuration - Setting attributes - Portability.php
@@ -76,3 +76,4 @@ renderCode("");
?>
+
diff --git a/manual/docs/Configuration - Setting attributes - Session lockmode.php b/manual/docs/Configuration - Setting attributes - Session lockmode.php
index e69de29bb..302a8d758 100644
--- a/manual/docs/Configuration - Setting attributes - Session lockmode.php
+++ b/manual/docs/Configuration - Setting attributes - Session lockmode.php
@@ -0,0 +1,6 @@
+
+
+// setting default lockmode
+
+$manager->setAttribute(Doctrine::ATTR_LOCKMODE, Doctrine::LOCK_PESSIMISTIC);
+
diff --git a/manual/docs/Configuration - Setting attributes - Table creation.php b/manual/docs/Configuration - Setting attributes - Table creation.php
index e69de29bb..82eca78a7 100644
--- a/manual/docs/Configuration - Setting attributes - Table creation.php
+++ b/manual/docs/Configuration - Setting attributes - Table creation.php
@@ -0,0 +1,6 @@
+
+
+// turns automatic table creation off
+
+$manager->setAttribute(Doctrine::ATTR_CREATE_TABLES, false);
+
diff --git a/manual/docs/Configuration - Setting attributes - Validation.php b/manual/docs/Configuration - Setting attributes - Validation.php
index e69de29bb..3c770280d 100644
--- a/manual/docs/Configuration - Setting attributes - Validation.php
+++ b/manual/docs/Configuration - Setting attributes - Validation.php
@@ -0,0 +1,6 @@
+
+
+// turns transactional validation on
+
+$manager->setAttribute(Doctrine::ATTR_VLD, true);
+
diff --git a/manual/codes/Configuration - Setting default eventlistener.php b/manual/docs/Configuration - Setting default eventlistener.php
similarity index 87%
rename from manual/codes/Configuration - Setting default eventlistener.php
rename to manual/docs/Configuration - Setting default eventlistener.php
index a3cb4920b..1dc8551db 100644
--- a/manual/codes/Configuration - Setting default eventlistener.php
+++ b/manual/docs/Configuration - Setting default eventlistener.php
@@ -1,4 +1,5 @@
-
class Email extends Doctrine_Record {
public function setUp() {
$this->setAttribute(Doctrine::ATTR_LISTENER,new MyListener());
@@ -7,4 +8,4 @@ class Email extends Doctrine_Record {
$this->hasColumn("address","string",150,"email|unique");
}
}
-?>
+
+$a = array('name' => 'userlist',
+ 'add' => array(
+ 'quota' => array(
+ 'type' => 'integer',
+ 'unsigned' => 1
+ )
+ ),
+ 'remove' => array(
+ 'file_limit' => array(),
+ 'time_limit' => array()
+ ),
+ 'change' => array(
+ 'name' => array(
+ 'length' => '20',
+ 'definition' => array(
+ 'type' => 'text',
+ 'length' => 20
+ )
+ )
+ ),
+ 'rename' => array(
+ 'sex' => array(
+ 'name' => 'gender',
+ 'definition' => array(
+ 'type' => 'text',
+ 'length' => 1,
+ 'default' => 'M'
+ )
+ )
+ )
+
+ );
+
+$dbh = new PDO('dsn','username','pw');
+$conn = Doctrine_Manager::getInstance()->openConnection($dbh);
+
+$conn->export->alterTable('mytable', $a);
+
diff --git a/manual/docs/Connection modules - Export - Creating new table.php b/manual/docs/Connection modules - Export - Creating new table.php
index e69de29bb..84ce54319 100644
--- a/manual/docs/Connection modules - Export - Creating new table.php
+++ b/manual/docs/Connection modules - Export - Creating new table.php
@@ -0,0 +1,23 @@
+
+
+$dbh = new PDO('dsn','username','pw');
+$conn = Doctrine_Manager::getInstance()->openConnection($dbh);
+
+$fields = array('id' => array(
+ 'type' => 'integer',
+ 'autoincrement' => true),
+ 'name' => array(
+ 'type' => 'string',
+ 'fixed' => true,
+ 'length' => 8)
+ );
+// the following option is mysql specific and
+// skipped by other drivers
+$options = array('type' => 'MYISAM');
+
+$conn->export->createTable('mytable', $fields);
+
+// on mysql this executes query:
+// CREATE TABLE mytable (id INT AUTO_INCREMENT PRIMARY KEY,
+// name CHAR(8));
+
diff --git a/manual/docs/Connection modules - Export - Introduction.php b/manual/docs/Connection modules - Export - Introduction.php
index e69de29bb..8b1378917 100644
--- a/manual/docs/Connection modules - Export - Introduction.php
+++ b/manual/docs/Connection modules - Export - Introduction.php
@@ -0,0 +1 @@
+
diff --git a/manual/docs/Connection modules - Import - Getting foreign key info.php b/manual/docs/Connection modules - Import - Getting foreign key info.php
index e69de29bb..8b1378917 100644
--- a/manual/docs/Connection modules - Import - Getting foreign key info.php
+++ b/manual/docs/Connection modules - Import - Getting foreign key info.php
@@ -0,0 +1 @@
+
diff --git a/manual/docs/Connection modules - Import - Getting table info.php b/manual/docs/Connection modules - Import - Getting table info.php
index e69de29bb..8b1378917 100644
--- a/manual/docs/Connection modules - Import - Getting table info.php
+++ b/manual/docs/Connection modules - Import - Getting table info.php
@@ -0,0 +1 @@
+
diff --git a/manual/docs/Connection modules - Import - Getting view info.php b/manual/docs/Connection modules - Import - Getting view info.php
index e69de29bb..8b1378917 100644
--- a/manual/docs/Connection modules - Import - Getting view info.php
+++ b/manual/docs/Connection modules - Import - Getting view info.php
@@ -0,0 +1 @@
+
diff --git a/manual/docs/Connection modules - Import - Introduction.php b/manual/docs/Connection modules - Import - Introduction.php
index e69de29bb..8b1378917 100644
--- a/manual/docs/Connection modules - Import - Introduction.php
+++ b/manual/docs/Connection modules - Import - Introduction.php
@@ -0,0 +1 @@
+
diff --git a/manual/docs/Connection modules - Util - Using explain.php b/manual/docs/Connection modules - Util - Using explain.php
index e69de29bb..8b1378917 100644
--- a/manual/docs/Connection modules - Util - Using explain.php
+++ b/manual/docs/Connection modules - Util - Using explain.php
@@ -0,0 +1 @@
+
diff --git a/manual/docs/DQL (Doctrine Query Language) - BNF.php b/manual/docs/DQL (Doctrine Query Language) - BNF.php
index e69de29bb..8b1378917 100644
--- a/manual/docs/DQL (Doctrine Query Language) - BNF.php
+++ b/manual/docs/DQL (Doctrine Query Language) - BNF.php
@@ -0,0 +1 @@
+
diff --git a/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - All and Any Expressions.php b/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - All and Any Expressions.php
index f79d91190..85f7a6d84 100644
--- a/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - All and Any Expressions.php
+++ b/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - All and Any Expressions.php
@@ -48,3 +48,4 @@ FROM C WHERE C.col1 <> ALL (FROM C2(col1));
FROM C WHERE C.col1 NOT IN (FROM C2(col1));
+
diff --git a/manual/codes/Coding standards - Naming Conventions - Variables.php b/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - All or Any Expressions.php
similarity index 50%
rename from manual/codes/Coding standards - Naming Conventions - Variables.php
rename to manual/docs/DQL (Doctrine Query Language) - Conditional expressions - All or Any Expressions.php
index d3f5a12fa..8b1378917 100644
--- a/manual/codes/Coding standards - Naming Conventions - Variables.php
+++ b/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - All or Any Expressions.php
@@ -1 +1 @@
-
+
diff --git a/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Between expressions.php b/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Between expressions.php
index d3f5a12fa..4e3ae44db 100644
--- a/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Between expressions.php
+++ b/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Between expressions.php
@@ -1 +1,3 @@
+
+
diff --git a/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Collection Member Expressions.php b/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Collection Member Expressions.php
index e69de29bb..8b1378917 100644
--- a/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Collection Member Expressions.php
+++ b/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Collection Member Expressions.php
@@ -0,0 +1 @@
+
diff --git a/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Empty Collection Comparison Expressions.php b/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Empty Collection Comparison Expressions.php
index e69de29bb..8b1378917 100644
--- a/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Empty Collection Comparison Expressions.php
+++ b/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Empty Collection Comparison Expressions.php
@@ -0,0 +1 @@
+
diff --git a/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Exists Expressions.php b/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Exists Expressions.php
index f8e2ebcc7..fa97cea36 100644
--- a/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Exists Expressions.php
+++ b/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Exists Expressions.php
@@ -24,3 +24,4 @@ FROM Article
WHERE ReaderLog.article_id = Article.id)
+
diff --git a/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - In expressions.php b/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - In expressions.php
index ba8406719..aae88e927 100644
--- a/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - In expressions.php
+++ b/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - In expressions.php
@@ -26,3 +26,4 @@ FROM C1 WHERE C1.col1 IN (FROM C2(col1));
+
diff --git a/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Input parameters.php b/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Input parameters.php
index e69de29bb..8e4a0c527 100644
--- a/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Input parameters.php
+++ b/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Input parameters.php
@@ -0,0 +1,15 @@
+
+
+
+// POSITIONAL PARAMETERS:
+$users = $conn->query("FROM User WHERE User.name = ?", array('Arnold'));
+
+$users = $conn->query("FROM User WHERE User.id > ? AND User.name LIKE ?", array(50, 'A%'));
+
+
+// NAMED PARAMETERS:
+
+$users = $conn->query("FROM User WHERE User.name = :name", array(':name' => 'Arnold'));
+
+$users = $conn->query("FROM User WHERE User.id > :id AND User.name LIKE :name", array(':id' => 50, ':name' => 'A%'));
+
diff --git a/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Like Expressions.php b/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Like Expressions.php
index 092c51e65..192eb47b7 100644
--- a/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Like Expressions.php
+++ b/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Like Expressions.php
@@ -22,3 +22,12 @@ Examples:
If the value of the string_expression or pattern_value is NULL or unknown, the value of the LIKE
expression is unknown. If the escape_characteris specified and is NULL, the value of the LIKE expression
is unknown.
+
+
+
+// finding all users whose email ends with '@gmail.com'
+$users = $conn->query("FROM User u, u.Email e WHERE e.address LIKE '%@gmail.com'");
+
+// finding all users whose name starts with letter 'A'
+$users = $conn->query("FROM User u WHERE u.name LIKE 'A%'");
+
diff --git a/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Literals.php b/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Literals.php
index 29fd3a35a..3c4299cc3 100644
--- a/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Literals.php
+++ b/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Literals.php
@@ -48,3 +48,4 @@ FROM User WHERE User.type = 'admin'
Predefined reserved literals are case insensitive, although its a good standard to write them in uppercase.
+
diff --git a/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Null Comparison Expressions.php b/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Null Comparison Expressions.php
index e69de29bb..8b1378917 100644
--- a/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Null Comparison Expressions.php
+++ b/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Null Comparison Expressions.php
@@ -0,0 +1 @@
+
diff --git a/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Operators and operator precedence.php b/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Operators and operator precedence.php
index ec193d0ba..9e2a75aa6 100644
--- a/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Operators and operator precedence.php
+++ b/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Operators and operator precedence.php
@@ -12,3 +12,4 @@ NOT
AND
OR
+
diff --git a/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Path expressions.php b/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Path expressions.php
index e69de29bb..8b1378917 100644
--- a/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Path expressions.php
+++ b/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Path expressions.php
@@ -0,0 +1 @@
+
diff --git a/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Subqueries.php b/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Subqueries.php
index 54a4c4f1c..bc62779c7 100644
--- a/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Subqueries.php
+++ b/manual/docs/DQL (Doctrine Query Language) - Conditional expressions - Subqueries.php
@@ -9,3 +9,23 @@ Some advantages of the subqueries:
+// finding all users which don't belong to any group 1
+$query = "FROM User WHERE User.id NOT IN
+ (SELECT u.id FROM User u
+ INNER JOIN u.Group g WHERE g.id = ?";
+
+$users = $conn->query($query, array(1));
+
+// finding all users which don't belong to any groups
+// Notice:
+// the usage of INNER JOIN
+// the usage of empty brackets preceding the Group component
+
+$query = "FROM User WHERE User.id NOT IN
+ (SELECT u.id FROM User u
+ INNER JOIN u.Group g)";
+
+$users = $conn->query($query);
+
diff --git a/manual/docs/DQL (Doctrine Query Language) - DELETE queries.php b/manual/docs/DQL (Doctrine Query Language) - DELETE queries.php
index 357dfd51f..76b235f7d 100644
--- a/manual/docs/DQL (Doctrine Query Language) - DELETE queries.php
+++ b/manual/docs/DQL (Doctrine Query Language) - DELETE queries.php
@@ -18,3 +18,20 @@ Without WHERE clause, all records are deleted.
The statement will stop as soon as it has deleted record_count records.
+
+
+$q = 'DELETE FROM Account WHERE id > ?';
+
+$rows = $this->conn->query($q, array(3));
+
+// the same query using the query interface
+
+$q = new Doctrine_Query();
+
+$rows = $q->delete('Account')
+ ->from('Account a')
+ ->where('a.id > ?', 3)
+ ->execute();
+
+print $rows; // the number of affected rows
+
diff --git a/manual/docs/DQL (Doctrine Query Language) - Examples.php b/manual/docs/DQL (Doctrine Query Language) - Examples.php
index e69de29bb..8b1378917 100644
--- a/manual/docs/DQL (Doctrine Query Language) - Examples.php
+++ b/manual/docs/DQL (Doctrine Query Language) - Examples.php
@@ -0,0 +1 @@
+
diff --git a/manual/docs/DQL (Doctrine Query Language) - FROM clause.php b/manual/docs/DQL (Doctrine Query Language) - FROM clause.php
index 084b837a6..72aec367c 100644
--- a/manual/docs/DQL (Doctrine Query Language) - FROM clause.php
+++ b/manual/docs/DQL (Doctrine Query Language) - FROM clause.php
@@ -29,3 +29,4 @@ SELECT u.*, p.* FROM User u INNER JOIN u.Phonenumber p
+
diff --git a/manual/docs/DQL (Doctrine Query Language) - Functional Expressions - Arithmetic functions.php b/manual/docs/DQL (Doctrine Query Language) - Functional Expressions - Arithmetic functions.php
index e69de29bb..8b1378917 100644
--- a/manual/docs/DQL (Doctrine Query Language) - Functional Expressions - Arithmetic functions.php
+++ b/manual/docs/DQL (Doctrine Query Language) - Functional Expressions - Arithmetic functions.php
@@ -0,0 +1 @@
+
diff --git a/manual/docs/DQL (Doctrine Query Language) - Functional Expressions - Collection functions.php b/manual/docs/DQL (Doctrine Query Language) - Functional Expressions - Collection functions.php
index e69de29bb..8b1378917 100644
--- a/manual/docs/DQL (Doctrine Query Language) - Functional Expressions - Collection functions.php
+++ b/manual/docs/DQL (Doctrine Query Language) - Functional Expressions - Collection functions.php
@@ -0,0 +1 @@
+
diff --git a/manual/docs/DQL (Doctrine Query Language) - Functional Expressions - Datetime functions.php b/manual/docs/DQL (Doctrine Query Language) - Functional Expressions - Datetime functions.php
index e69de29bb..8b1378917 100644
--- a/manual/docs/DQL (Doctrine Query Language) - Functional Expressions - Datetime functions.php
+++ b/manual/docs/DQL (Doctrine Query Language) - Functional Expressions - Datetime functions.php
@@ -0,0 +1 @@
+
diff --git a/manual/docs/DQL (Doctrine Query Language) - Functional Expressions - String functions.php b/manual/docs/DQL (Doctrine Query Language) - Functional Expressions - String functions.php
index 525bfeb34..54e7c9709 100644
--- a/manual/docs/DQL (Doctrine Query Language) - Functional Expressions - String functions.php
+++ b/manual/docs/DQL (Doctrine Query Language) - Functional Expressions - String functions.php
@@ -74,3 +74,4 @@ returned.
+$q = new Doctrine_Query();
+
+$q->from('User')->where('User.Phonenumber.phonenumber.contains(?,?,?)');
+
+$users = $q->execute(array('123 123 123', '0400 999 999', '+358 100 100'));
+
diff --git a/manual/docs/DQL (Doctrine Query Language) - Functions - Like.php b/manual/docs/DQL (Doctrine Query Language) - Functions - Like.php
index e69de29bb..32bf2999e 100644
--- a/manual/docs/DQL (Doctrine Query Language) - Functions - Like.php
+++ b/manual/docs/DQL (Doctrine Query Language) - Functions - Like.php
@@ -0,0 +1,8 @@
+
+
+$q = new Doctrine_Query();
+
+$q->from('User')->where('User.Phonenumber.phonenumber.like(?,?)');
+
+$users = $q->execute(array('%123%', '456%'));
+
diff --git a/manual/docs/DQL (Doctrine Query Language) - Functions - Regexp.php b/manual/docs/DQL (Doctrine Query Language) - Functions - Regexp.php
index e69de29bb..6e1fb4736 100644
--- a/manual/docs/DQL (Doctrine Query Language) - Functions - Regexp.php
+++ b/manual/docs/DQL (Doctrine Query Language) - Functions - Regexp.php
@@ -0,0 +1,8 @@
+
+
+$q = new Doctrine_Query();
+
+$q->from('User')->where('User.Phonenumber.phonenumber.regexp(?,?)');
+
+$users = $q->execute(array('[123]', '^[3-5]'));
+
diff --git a/manual/docs/DQL (Doctrine Query Language) - GROUP BY, HAVING clauses.php b/manual/docs/DQL (Doctrine Query Language) - GROUP BY, HAVING clauses.php
index 2dc50e8fe..8d61ce2f7 100644
--- a/manual/docs/DQL (Doctrine Query Language) - GROUP BY, HAVING clauses.php
+++ b/manual/docs/DQL (Doctrine Query Language) - GROUP BY, HAVING clauses.php
@@ -38,3 +38,14 @@ SELECT u.* FROM User u, u.Phonenumber p HAVING COUNT(p.id) >= 2
+
+
+
+// retrieve all users and the phonenumber count for each user
+
+$users = $conn->query("SELECT u.*, COUNT(p.id) count FROM User u, u.Phonenumber p GROUP BY u.id");
+
+foreach($users as $user) {
+ print $user->name . ' has ' . $user->Phonenumber[0]->count . ' phonenumbers';
+}
+
diff --git a/manual/codes/Coding standards - PHP File Formatting - Line termination.php b/manual/docs/DQL (Doctrine Query Language) - GROUP BY, HAVING.php
similarity index 50%
rename from manual/codes/Coding standards - PHP File Formatting - Line termination.php
rename to manual/docs/DQL (Doctrine Query Language) - GROUP BY, HAVING.php
index d3f5a12fa..8b1378917 100644
--- a/manual/codes/Coding standards - PHP File Formatting - Line termination.php
+++ b/manual/docs/DQL (Doctrine Query Language) - GROUP BY, HAVING.php
@@ -1 +1 @@
-
+
diff --git a/manual/docs/DQL (Doctrine Query Language) - Introduction.php b/manual/docs/DQL (Doctrine Query Language) - Introduction.php
index c45e19ff6..a432af305 100644
--- a/manual/docs/DQL (Doctrine Query Language) - Introduction.php
+++ b/manual/docs/DQL (Doctrine Query Language) - Introduction.php
@@ -21,3 +21,30 @@ When compared to using raw SQL, DQL has several benefits:
If the power of DQL isn't enough, you should consider using the rawSql API for object population.
+
+
+// DO NOT USE THE FOLLOWING CODE
+// (using many sql queries for object population):
+
+$users = $conn->getTable('User')->findAll();
+
+foreach($users as $user) {
+ print $user->name."
diff --git a/manual/docs/DQL (Doctrine Query Language) - LIMIT and OFFSET clauses - Driver portability.php b/manual/docs/DQL (Doctrine Query Language) - LIMIT and OFFSET clauses - Driver portability.php
index ae2abfd56..6720d7a82 100644
--- a/manual/docs/DQL (Doctrine Query Language) - LIMIT and OFFSET clauses - Driver portability.php
+++ b/manual/docs/DQL (Doctrine Query Language) - LIMIT and OFFSET clauses - Driver portability.php
@@ -10,3 +10,4 @@ LIMIT clause in subqueries
";
+ foreach($user->Phonenumber as $phonenumber) {
+ print $phonenumber."
";
+ }
+}
+
+// same thing implemented much more efficiently:
+// (using only one sql query for object population)
+
+$users = $conn->query("FROM User.Phonenumber");
+
+foreach($users as $user) {
+ print $user->name."
";
+ foreach($user->Phonenumber as $phonenumber) {
+ print $phonenumber."
";
+ }
+}
+
+
when pgsql driver is used
+
+// retrieve the first 20 users and all their associated phonenumbers
+
+$users = $conn->query("SELECT u.*, p.* FROM User u, u.Phonenumber p LIMIT 20");
+
+foreach($users as $user) {
+ print ' --- '.$user->name.' --- \n';
+
+ foreach($user->Phonenumber as $p) {
+ print $p->phonenumber.'\n';
+ }
+}
+
diff --git a/manual/codes/DQL (Doctrine Query Language) - Conditional expressions - Between expressions.php b/manual/docs/DQL (Doctrine Query Language) - LIMIT and OFFSET.php
similarity index 50%
rename from manual/codes/DQL (Doctrine Query Language) - Conditional expressions - Between expressions.php
rename to manual/docs/DQL (Doctrine Query Language) - LIMIT and OFFSET.php
index d3f5a12fa..8b1378917 100644
--- a/manual/codes/DQL (Doctrine Query Language) - Conditional expressions - Between expressions.php
+++ b/manual/docs/DQL (Doctrine Query Language) - LIMIT and OFFSET.php
@@ -1 +1 @@
-
+
diff --git a/manual/codes/Working with objects - Component overview - Connection - Introduction.php b/manual/docs/DQL (Doctrine Query Language) - ORDER BY clause.php
similarity index 50%
rename from manual/codes/Working with objects - Component overview - Connection - Introduction.php
rename to manual/docs/DQL (Doctrine Query Language) - ORDER BY clause.php
index d3f5a12fa..8b1378917 100644
--- a/manual/codes/Working with objects - Component overview - Connection - Introduction.php
+++ b/manual/docs/DQL (Doctrine Query Language) - ORDER BY clause.php
@@ -1 +1 @@
-
+
diff --git a/manual/docs/DQL (Doctrine Query Language) - ORDER BY.php b/manual/docs/DQL (Doctrine Query Language) - ORDER BY.php
new file mode 100644
index 000000000..8b1378917
--- /dev/null
+++ b/manual/docs/DQL (Doctrine Query Language) - ORDER BY.php
@@ -0,0 +1 @@
+
diff --git a/manual/docs/DQL (Doctrine Query Language) - Operators - Logical operators.php b/manual/docs/DQL (Doctrine Query Language) - Operators - Logical operators.php
index 3b63ada08..37e479bc8 100644
--- a/manual/docs/DQL (Doctrine Query Language) - Operators - Logical operators.php
+++ b/manual/docs/DQL (Doctrine Query Language) - Operators - Logical operators.php
@@ -108,3 +108,4 @@
+// SELECT u.*, COUNT(p.id) num_posts FROM User u, u.Posts p WHERE u.id = 1 GROUP BY u.id
+
+$query = new Doctrine_Query();
+
+$query->select('u.*, COUNT(p.id) num_posts')
+ ->from('User u, u.Posts p')
+ ->where('u.id = ?', 1)
+ ->groupby('u.id');
+
+$users = $query->execute();
+
+echo $users->Posts[0]->num_posts . ' posts found';
+
diff --git a/manual/docs/DQL (Doctrine Query Language) - SELECT queries.php b/manual/docs/DQL (Doctrine Query Language) - SELECT queries.php
index cf4df113f..3c4c2a070 100644
--- a/manual/docs/DQL (Doctrine Query Language) - SELECT queries.php
+++ b/manual/docs/DQL (Doctrine Query Language) - SELECT queries.php
@@ -67,3 +67,4 @@ SELECT u.* FROM User u LIMIT 20
+
diff --git a/manual/docs/DQL (Doctrine Query Language) - UPDATE queries.php b/manual/docs/DQL (Doctrine Query Language) - UPDATE queries.php
index ab308d48c..8d34a2a8d 100644
--- a/manual/docs/DQL (Doctrine Query Language) - UPDATE queries.php
+++ b/manual/docs/DQL (Doctrine Query Language) - UPDATE queries.php
@@ -22,3 +22,20 @@ Without WHERE clause, all records are updated.
A LIMIT clause is a rows-matched restriction not a rows-changed restriction.
The statement stops as soon as it has found record_count rows that satisfy the WHERE clause, whether or not they actually were changed.
+
+
+$q = 'UPDATE Account SET amount = amount + 200 WHERE id > 200';
+
+$rows = $this->conn->query($q);
+
+// the same query using the query interface
+
+$q = new Doctrine_Query();
+
+$rows = $q->update('Account')
+ ->set('amount', 'amount + 200')
+ ->where('id > 200')
+ ->execute();
+
+print $rows; // the number of affected rows
+
diff --git a/manual/docs/DQL (Doctrine Query Language) - WHERE clause.php b/manual/docs/DQL (Doctrine Query Language) - WHERE clause.php
index c3f4b29d1..f115102a8 100644
--- a/manual/docs/DQL (Doctrine Query Language) - WHERE clause.php
+++ b/manual/docs/DQL (Doctrine Query Language) - WHERE clause.php
@@ -14,3 +14,4 @@ WHERE where_condition
In cases where this might fail, a Doctrine_Exception is throw detailing the error.
+ +
+Doctrine::compile();
+
+// on some other script:
+
+require_once("path_to_doctrine/Doctrine.compiled.php");
+
diff --git a/manual/docs/Getting started - Data types - Array.php b/manual/docs/Getting started - Data types - Array.php
new file mode 100644
index 000000000..8b1378917
--- /dev/null
+++ b/manual/docs/Getting started - Data types - Array.php
@@ -0,0 +1 @@
+
diff --git a/manual/docs/Getting started - Data types - Blob.php b/manual/docs/Getting started - Data types - Blob.php
new file mode 100644
index 000000000..8b1378917
--- /dev/null
+++ b/manual/docs/Getting started - Data types - Blob.php
@@ -0,0 +1 @@
+
diff --git a/manual/docs/Getting started - Data types - Boolean.php b/manual/docs/Getting started - Data types - Boolean.php
new file mode 100644
index 000000000..8b1378917
--- /dev/null
+++ b/manual/docs/Getting started - Data types - Boolean.php
@@ -0,0 +1 @@
+
diff --git a/manual/docs/Getting started - Data types - Clob.php b/manual/docs/Getting started - Data types - Clob.php
new file mode 100644
index 000000000..8b1378917
--- /dev/null
+++ b/manual/docs/Getting started - Data types - Clob.php
@@ -0,0 +1 @@
+
diff --git a/manual/docs/Getting started - Data types - Date.php b/manual/docs/Getting started - Data types - Date.php
new file mode 100644
index 000000000..8b1378917
--- /dev/null
+++ b/manual/docs/Getting started - Data types - Date.php
@@ -0,0 +1 @@
+
diff --git a/manual/docs/Getting started - Data types - Enum.php b/manual/docs/Getting started - Data types - Enum.php
new file mode 100644
index 000000000..8b1378917
--- /dev/null
+++ b/manual/docs/Getting started - Data types - Enum.php
@@ -0,0 +1 @@
+
diff --git a/manual/docs/Getting started - Data types - Float.php b/manual/docs/Getting started - Data types - Float.php
new file mode 100644
index 000000000..8b1378917
--- /dev/null
+++ b/manual/docs/Getting started - Data types - Float.php
@@ -0,0 +1 @@
+
diff --git a/manual/docs/Getting started - Data types - Gzip.php b/manual/docs/Getting started - Data types - Gzip.php
new file mode 100644
index 000000000..8b1378917
--- /dev/null
+++ b/manual/docs/Getting started - Data types - Gzip.php
@@ -0,0 +1 @@
+
diff --git a/manual/docs/Getting started - Data types - Integer.php b/manual/docs/Getting started - Data types - Integer.php
new file mode 100644
index 000000000..8b1378917
--- /dev/null
+++ b/manual/docs/Getting started - Data types - Integer.php
@@ -0,0 +1 @@
+
diff --git a/manual/docs/Getting started - Data types - Object.php b/manual/docs/Getting started - Data types - Object.php
new file mode 100644
index 000000000..8b1378917
--- /dev/null
+++ b/manual/docs/Getting started - Data types - Object.php
@@ -0,0 +1 @@
+
diff --git a/manual/docs/Getting started - Data types - String.php b/manual/docs/Getting started - Data types - String.php
new file mode 100644
index 000000000..8b1378917
--- /dev/null
+++ b/manual/docs/Getting started - Data types - String.php
@@ -0,0 +1 @@
+
diff --git a/manual/docs/Getting started - Data types - Timestamp.php b/manual/docs/Getting started - Data types - Timestamp.php
new file mode 100644
index 000000000..8b1378917
--- /dev/null
+++ b/manual/docs/Getting started - Data types - Timestamp.php
@@ -0,0 +1 @@
+
diff --git a/manual/docs/Getting started - Requirements.php b/manual/docs/Getting started - Requirements.php
index be29d5ba4..0c9b7213c 100644
--- a/manual/docs/Getting started - Requirements.php
+++ b/manual/docs/Getting started - Requirements.php
@@ -1,2 +1,3 @@
Doctrine requires PHP >= 5.1. it doesn't require any external libraries.
For database abstraction Doctrine uses PDO which is bundled with php by default. Doctrine also requires a little adodb-hack for table creation, which comes with doctrine.
+
diff --git a/manual/docs/Getting started - Setting table definition - Constraints and validators.php b/manual/docs/Getting started - Setting table definition - Constraints and validators.php
index 11f69ac63..8b9ef5b89 100644
--- a/manual/docs/Getting started - Setting table definition - Constraints and validators.php
+++ b/manual/docs/Getting started - Setting table definition - Constraints and validators.php
@@ -240,3 +240,19 @@ Following attributes are availible for columns
+
+
+class User extends Doctrine_Record {
+ public function setTableDefinition() {
+ // the name cannot contain whitespace
+ $this->hasColumn("name", "string", 50, array("nospace" => true));
+
+ // the email should be a valid email
+ $this->hasColumn("email", "string", 200, array("email" => true));
+
+ // home_country should be a valid country code and not null
+ $this->hasColumn("home_country", "string", 2, array("country" => true, "notnull" => true));
+
+ }
+}
+
diff --git a/manual/docs/Getting started - Setting table definition - Data types and lengths.php b/manual/docs/Getting started - Setting table definition - Data types and lengths.php
index f90719b15..4dca2aaa0 100644
--- a/manual/docs/Getting started - Setting table definition - Data types and lengths.php
+++ b/manual/docs/Getting started - Setting table definition - Data types and lengths.php
@@ -36,3 +36,31 @@ However when the record is validated it is only allowed to have 'content' -colum
In general Doctrine is smart enough to know which integer/string type to use depending on the specified length.
+class Article extends Doctrine_Record {
+ public function setTableDefinition() {
+ // few mapping examples:
+
+ // maps into VARCHAR(100) on mysql
+ $this->hasColumn("title","string",100);
+
+ // maps into TEXT on mysql
+ $this->hasColumn("content","string",4000);
+
+ // maps into TINYINT on mysql
+ $this->hasColumn("type","integer",1);
+
+ // maps into INT on mysql
+ $this->hasColumn("type2","integer",11);
+
+ // maps into BIGINT on mysql
+ $this->hasColumn("type3","integer",20);
+
+ // maps into TEXT on mysql
+ // (serialized and unserialized automatically by doctrine)
+ $this->hasColumn("types","array",4000);
+
+ }
+}
+
diff --git a/manual/docs/Getting started - Setting table definition - Default values.php b/manual/docs/Getting started - Setting table definition - Default values.php
index a80071b9d..ea1648215 100644
--- a/manual/docs/Getting started - Setting table definition - Default values.php
+++ b/manual/docs/Getting started - Setting table definition - Default values.php
@@ -17,3 +17,4 @@ print \$user->name; // default name
?>
+class Article extends Doctrine_Record {
+ public function setTableDefinition() {
+ $this->hasColumn("title","string", 200);
+
+ // maps to TINYINT on mysql
+ $this->hasColumn("section", "enum", 2, array('values' => array("PHP","Python","Java","Ruby")));
+ }
+}
+$article = new Article;
+$article->title = 'My first php article';
+// doctrine auto-converts the section to integer when the
+// record is being saved
+$article->section = 'PHP';
+$article->save();
+
+// on insert query with values 'My first php article' and 0
+// would be issued
+
diff --git a/manual/docs/Getting started - Setting table definition - Table options.php b/manual/docs/Getting started - Setting table definition - Table options.php
new file mode 100644
index 000000000..8b1378917
--- /dev/null
+++ b/manual/docs/Getting started - Setting table definition - Table options.php
@@ -0,0 +1 @@
+
diff --git a/manual/codes/Getting started - Setting table definition.php b/manual/docs/Getting started - Setting table definition.php
similarity index 90%
rename from manual/codes/Getting started - Setting table definition.php
rename to manual/docs/Getting started - Setting table definition.php
index 23b9057be..2007b4dbb 100644
--- a/manual/codes/Getting started - Setting table definition.php
+++ b/manual/docs/Getting started - Setting table definition.php
@@ -1,4 +1,5 @@
-
class Email extends Doctrine_Record {
public function setTableDefinition() {
/**
@@ -12,4 +13,4 @@ class Email extends Doctrine_Record {
$this->hasColumn("address","string",200,"email|unique");
}
}
-?>
+
diff --git a/manual/docs/Hierarchical data - Adjacency list - Introduction.php b/manual/docs/Hierarchical data - Adjacency list - Introduction.php
new file mode 100644
index 000000000..8b1378917
--- /dev/null
+++ b/manual/docs/Hierarchical data - Adjacency list - Introduction.php
@@ -0,0 +1 @@
+
diff --git a/manual/codes/Hierarchical data - Examples.php b/manual/docs/Hierarchical data - Examples.php
similarity index 99%
rename from manual/codes/Hierarchical data - Examples.php
rename to manual/docs/Hierarchical data - Examples.php
index 5886a866d..db1c059ea 100644
--- a/manual/codes/Hierarchical data - Examples.php
+++ b/manual/docs/Hierarchical data - Examples.php
@@ -1,4 +1,5 @@
-
require_once("path/to/Doctrine.php");
@@ -385,4 +386,4 @@ function output_message($msg)
{
echo "
+class Book extends Doctrine_Record
+{
+ public function setTableDefinition()
+ {
+ $this->hasColumn('bookName as name', 'string');
+ }
+}
+$book = new Book();
+$book->name = 'Some book';
+$book->save();
+
diff --git a/manual/docs/Object relational mapping - Columns - Column naming.php b/manual/docs/Object relational mapping - Columns - Column naming.php
index 485159914..1bf034c49 100644
--- a/manual/docs/Object relational mapping - Columns - Column naming.php
+++ b/manual/docs/Object relational mapping - Columns - Column naming.php
@@ -12,3 +12,4 @@ access it through $record->myField (or $record['myField'], whatever you prefer)
or Postgres or Oracle ect.
+class Test extends Doctrine_Record {
+ public function setTableDefinition() {
+ $this->hasColumn('arraytest', 'array', 10000);
+ }
+}
+
diff --git a/manual/docs/Object relational mapping - Columns - Data types - Blob.php b/manual/docs/Object relational mapping - Columns - Data types - Blob.php
index 39960564c..8d4ea45f8 100644
--- a/manual/docs/Object relational mapping - Columns - Data types - Blob.php
+++ b/manual/docs/Object relational mapping - Columns - Data types - Blob.php
@@ -1,3 +1,11 @@
Blob (Binary Large OBject) data type is meant to store data of undefined length that may be too large to store in text fields, like data that is usually stored in files.
+class Test extends Doctrine_Record {
+ public function setTableDefinition() {
+ $this->hasColumn('blobtest', 'blob');
+ }
+}
+
diff --git a/manual/docs/Object relational mapping - Columns - Data types - Boolean.php b/manual/docs/Object relational mapping - Columns - Data types - Boolean.php
index 455f92351..39caa37e8 100644
--- a/manual/docs/Object relational mapping - Columns - Data types - Boolean.php
+++ b/manual/docs/Object relational mapping - Columns - Data types - Boolean.php
@@ -3,3 +3,11 @@ Do not assume that these data types are stored as integers because some DBMS dri
type with single character text fields for a matter of efficiency.
Ternary logic is possible by using null as the third possible value that may be assigned to fields of this type.
+
+
+class Test extends Doctrine_Record {
+ public function setTableDefinition() {
+ $this->hasColumn('booltest', 'boolean');
+ }
+}
+
diff --git a/manual/docs/Object relational mapping - Columns - Data types - Clob.php b/manual/docs/Object relational mapping - Columns - Data types - Clob.php
index 5baca179e..67fc62735 100644
--- a/manual/docs/Object relational mapping - Columns - Data types - Clob.php
+++ b/manual/docs/Object relational mapping - Columns - Data types - Clob.php
@@ -3,3 +3,11 @@ Clob (Character Large OBject) data type is meant to store data of undefined leng
Clob fields are meant to store only data made of printable ASCII characters whereas blob fields are meant to store all types of data.
+class Test extends Doctrine_Record {
+ public function setTableDefinition() {
+ $this->hasColumn('clobtest', 'clob');
+ }
+}
+
diff --git a/manual/docs/Object relational mapping - Columns - Data types - Date.php b/manual/docs/Object relational mapping - Columns - Data types - Date.php
index 77ca90f66..937dd2312 100644
--- a/manual/docs/Object relational mapping - Columns - Data types - Date.php
+++ b/manual/docs/Object relational mapping - Columns - Data types - Date.php
@@ -4,3 +4,11 @@ The format defined by the ISO-8601 standard for dates is YYYY-MM-DD where YYYY i
+class Test extends Doctrine_Record {
+ public function setTableDefinition() {
+ $this->hasColumn('datetest', 'date');
+ }
+}
+
diff --git a/manual/docs/Object relational mapping - Columns - Data types - Enum.php b/manual/docs/Object relational mapping - Columns - Data types - Enum.php
index 12d32e777..ded9d05a9 100644
--- a/manual/docs/Object relational mapping - Columns - Data types - Enum.php
+++ b/manual/docs/Object relational mapping - Columns - Data types - Enum.php
@@ -1,2 +1,18 @@
Doctrine has a unified enum type. Enum typed columns automatically convert the string values into index numbers and vice versa. The possible values for the column
can be specified with Doctrine_Record::setEnumValues(columnName, array values).
+
+
+class Test extends Doctrine_Record {
+ public function setTableDefinition() {
+ $this->hasColumn('enumtest', 'enum', 4,
+ array(
+ 'values' => array(
+ 'php',
+ 'java',
+ 'python'
+ )
+ )
+ );
+ }
+}
+
diff --git a/manual/docs/Object relational mapping - Columns - Data types - Float.php b/manual/docs/Object relational mapping - Columns - Data types - Float.php
index fcee1d5b0..e32f9c484 100644
--- a/manual/docs/Object relational mapping - Columns - Data types - Float.php
+++ b/manual/docs/Object relational mapping - Columns - Data types - Float.php
@@ -1 +1,9 @@
The float data type may store floating point decimal numbers. This data type is suitable for representing numbers within a large scale range that do not require high accuracy. The scale and the precision limits of the values that may be stored in a database depends on the DBMS that it is used.
+
+
+class Test extends Doctrine_Record {
+ public function setTableDefinition() {
+ $this->hasColumn('floattest', 'float');
+ }
+}
+
diff --git a/manual/docs/Object relational mapping - Columns - Data types - Gzip.php b/manual/docs/Object relational mapping - Columns - Data types - Gzip.php
index 44bb0616d..58d270876 100644
--- a/manual/docs/Object relational mapping - Columns - Data types - Gzip.php
+++ b/manual/docs/Object relational mapping - Columns - Data types - Gzip.php
@@ -1 +1,9 @@
Gzip datatype is the same as string except that its automatically compressed when persisted and uncompressed when fetched. This datatype can be useful when storing data with a large compressibility ratio, such as bitmap images.
+
+
+class Test extends Doctrine_Record {
+ public function setTableDefinition() {
+ $this->hasColumn('gziptest', 'gzip');
+ }
+}
+
diff --git a/manual/docs/Object relational mapping - Columns - Data types - Integer.php b/manual/docs/Object relational mapping - Columns - Data types - Integer.php
index 9ccfefba7..1077b3811 100644
--- a/manual/docs/Object relational mapping - Columns - Data types - Integer.php
+++ b/manual/docs/Object relational mapping - Columns - Data types - Integer.php
@@ -4,3 +4,11 @@ Fields of this type may be created optionally as unsigned integers but not all D
Therefore, such option may be ignored. Truly portable applications should not rely on the availability of this option.
+class Test extends Doctrine_Record {
+ public function setTableDefinition() {
+ $this->hasColumn('integertest', 'integer', 4, array('unsigned' => true));
+ }
+}
+
diff --git a/manual/docs/Object relational mapping - Columns - Data types - Introduction.php b/manual/docs/Object relational mapping - Columns - Data types - Introduction.php
index af4218785..a7fb8bd4a 100644
--- a/manual/docs/Object relational mapping - Columns - Data types - Introduction.php
+++ b/manual/docs/Object relational mapping - Columns - Data types - Introduction.php
@@ -22,3 +22,4 @@ Example 2. Column with type 'integer' and length 1 results in 'TINYINT' on many
+class Test extends Doctrine_Record {
+ public function setTableDefinition() {
+ $this->hasColumn('objecttest', 'object');
+ }
+}
+
diff --git a/manual/docs/Object relational mapping - Columns - Data types - String.php b/manual/docs/Object relational mapping - Columns - Data types - String.php
index a7ca626bd..da6179f8a 100644
--- a/manual/docs/Object relational mapping - Columns - Data types - String.php
+++ b/manual/docs/Object relational mapping - Columns - Data types - String.php
@@ -5,3 +5,11 @@ The length limited option is the most recommended for efficiency reasons. The un
The fields of this type should be able to handle 8 bit characters. Drivers take care of DBMS specific escaping of characters of special meaning with the values of the strings to be converted to this type.
+class Test extends Doctrine_Record {
+ public function setTableDefinition() {
+ $this->hasColumn('stringtest', 'string', 200, array('fixed' => true));
+ }
+}
+
diff --git a/manual/docs/Object relational mapping - Columns - Data types - Time.php b/manual/docs/Object relational mapping - Columns - Data types - Time.php
index dc3928777..2a50227c4 100644
--- a/manual/docs/Object relational mapping - Columns - Data types - Time.php
+++ b/manual/docs/Object relational mapping - Columns - Data types - Time.php
@@ -4,3 +4,11 @@ The format defined by the ISO-8601 standard for the time of the day is HH:MI:SS
+class Test extends Doctrine_Record {
+ public function setTableDefinition() {
+ $this->hasColumn('timetest', 'time');
+ }
+}
+
diff --git a/manual/docs/Object relational mapping - Columns - Data types - Timestamp.php b/manual/docs/Object relational mapping - Columns - Data types - Timestamp.php
index 4699e811a..783093395 100644
--- a/manual/docs/Object relational mapping - Columns - Data types - Timestamp.php
+++ b/manual/docs/Object relational mapping - Columns - Data types - Timestamp.php
@@ -2,3 +2,11 @@ The timestamp data type is a mere combination of the date and the time of the da
The representation of values of the time stamp type is accomplished by joining the date and time
string values in a single string joined by a space. Therefore, the format template is YYYY-MM-DD HH:MI:SS.
The represented values obey the same rules and ranges described for the date and time data types
+
+
+class Test extends Doctrine_Record {
+ public function setTableDefinition() {
+ $this->hasColumn('timestamptest', 'timestamp');
+ }
+}
+
diff --git a/manual/docs/Object relational mapping - Columns - Data types - Type modifiers.php b/manual/docs/Object relational mapping - Columns - Data types - Type modifiers.php
index f9796c975..44f1284f3 100644
--- a/manual/docs/Object relational mapping - Columns - Data types - Type modifiers.php
+++ b/manual/docs/Object relational mapping - Columns - Data types - Type modifiers.php
@@ -45,3 +45,4 @@ Using the above example, we can also explore the default field operator. Default
+class User extends Doctrine_Record {
+ public function setTableDefinition() {
+ $this->hasColumn('uid','integer',20,'primary|autoincrement');
+
+ }
+}
+
diff --git a/manual/docs/Object relational mapping - Record identifiers - Composite.php b/manual/docs/Object relational mapping - Record identifiers - Composite.php
index 37f636a03..ec30807ab 100644
--- a/manual/docs/Object relational mapping - Record identifiers - Composite.php
+++ b/manual/docs/Object relational mapping - Record identifiers - Composite.php
@@ -2,3 +2,12 @@ Composite primary key can be used efficiently in association tables (tables that
to use composite primary keys in anywhere else as Doctrine does not support mapping relations on multiple columns.
+class Groupuser extends Doctrine_Record {
+ public function setTableDefinition() {
+ $this->hasColumn('user_id', 'integer', 20, 'primary');
+ $this->hasColumn('group_id', 'integer', 20, 'primary');
+ }
+}
+
diff --git a/manual/docs/Object relational mapping - Record identifiers - Introduction.php b/manual/docs/Object relational mapping - Record identifiers - Introduction.php
index 2965d26eb..b111e4ab7 100644
--- a/manual/docs/Object relational mapping - Record identifiers - Introduction.php
+++ b/manual/docs/Object relational mapping - Record identifiers - Introduction.php
@@ -2,3 +2,4 @@ Doctrine supports many kind of identifiers. For most cases it is recommended not
specify any primary keys (Doctrine will then use field name 'id' as an autoincremented
primary key). When using table creation Doctrine is smart enough to emulate the
autoincrementation with sequences and triggers on databases that doesn't support it natively.
+
diff --git a/manual/docs/Object relational mapping - Record identifiers - Natural.php b/manual/docs/Object relational mapping - Record identifiers - Natural.php
index 4dc0d94c2..cfb204e61 100644
--- a/manual/docs/Object relational mapping - Record identifiers - Natural.php
+++ b/manual/docs/Object relational mapping - Record identifiers - Natural.php
@@ -1,2 +1,10 @@
Natural identifier is a property or combination of properties that is unique and non-null. The use of natural identifiers
is discouraged. You should consider using autoincremented or sequential primary keys as they make your system more scalable.
+
+
+class User extends Doctrine_Record {
+ public function setTableDefinition() {
+ $this->hasColumn('name','string',200,'primary');
+ }
+}
+
diff --git a/manual/docs/Object relational mapping - Record identifiers - Sequence.php b/manual/docs/Object relational mapping - Record identifiers - Sequence.php
index 9235c9532..c42f08731 100644
--- a/manual/docs/Object relational mapping - Record identifiers - Sequence.php
+++ b/manual/docs/Object relational mapping - Record identifiers - Sequence.php
@@ -66,3 +66,4 @@ class Book extends Doctrine_Record {
}
?>");
?>
+
diff --git a/manual/docs/Object relational mapping - Record identifiers - Sequential.php b/manual/docs/Object relational mapping - Record identifiers - Sequential.php
new file mode 100644
index 000000000..8b1378917
--- /dev/null
+++ b/manual/docs/Object relational mapping - Record identifiers - Sequential.php
@@ -0,0 +1 @@
+
diff --git a/manual/docs/Object relational mapping - Relations - Composites and aggregates.php b/manual/docs/Object relational mapping - Relations - Composites and aggregates.php
index efbe9f42e..ff03450b4 100644
--- a/manual/docs/Object relational mapping - Relations - Composites and aggregates.php
+++ b/manual/docs/Object relational mapping - Relations - Composites and aggregates.php
@@ -7,3 +7,4 @@ Email record is also deleted.
+class User extends Doctrine_Record {
+ public function setUp() {
+ $this->ownsMany('Phonenumber','Phonenumber.user_id');
+ }
+ public function setTableDefition() {
+ $this->hasColumn('name','string',50);
+ $this->hasColumn('loginname','string',20);
+ $this->hasColumn('password','string',16);
+ }
+}
+class Phonenumber extends Doctrine_Record {
+ public function setTableDefinition() {
+ $this->hasColumn('phonenumber','string',50);
+ $this->hasColumn('user_id','integer');
+ }
+}
+
diff --git a/manual/docs/Object relational mapping - Relations - Foreign key associations - One-to-One.php b/manual/docs/Object relational mapping - Relations - Foreign key associations - One-to-One.php
index b279556ff..f7dfc414a 100644
--- a/manual/docs/Object relational mapping - Relations - Foreign key associations - One-to-One.php
+++ b/manual/docs/Object relational mapping - Relations - Foreign key associations - One-to-One.php
@@ -5,3 +5,32 @@ The relationship between user and address is one-to-one aggregate.
The Email component here is mapped to User component's column email_id hence their relation is called LOCALKEY relation.
On the other hand the Address component is mapped to User by it's user_id column hence the relation between User and Address is called
FOREIGNKEY relation.
+
+
+class User extends Doctrine_Record {
+ public function setUp() {
+ $this->hasOne('Address','Address.user_id');
+ $this->ownsOne('Email','User.email_id');
+ $this->ownsMany('Phonenumber','Phonenumber.user_id');
+ }
+ public function setTableDefition() {
+ $this->hasColumn('name','string',50);
+ $this->hasColumn('loginname','string',20);
+ $this->hasColumn('password','string',16);
+
+ // foreign key column for email ID
+ $this->hasColumn('email_id','integer');
+ }
+}
+class Email extends Doctrine_Record {
+ public function setTableDefinition() {
+ $this->hasColumn('address','string',150);
+ }
+}
+class Address extends Doctrine_Record {
+ public function setTableDefinition() {
+ $this->hasColumn('street','string',50);
+ $this->hasColumn('user_id','integer');
+ }
+}
+
diff --git a/manual/docs/Object relational mapping - Relations - Foreign key associations - Tree structure.php b/manual/docs/Object relational mapping - Relations - Foreign key associations - Tree structure.php
index e69de29bb..ecb9e7c12 100644
--- a/manual/docs/Object relational mapping - Relations - Foreign key associations - Tree structure.php
+++ b/manual/docs/Object relational mapping - Relations - Foreign key associations - Tree structure.php
@@ -0,0 +1,13 @@
+
+
+class Task extends Doctrine_Record {
+ public function setUp() {
+ $this->hasOne('Task as Parent','Task.parent_id');
+ $this->hasMany('Task as Subtask','Subtask.parent_id');
+ }
+ public function setTableDefinition() {
+ $this->hasColumn('name','string',100);
+ $this->hasColumn('parent_id','integer');
+ }
+}
+
diff --git a/manual/docs/Object relational mapping - Relations - Inheritance - One table many classes.php b/manual/docs/Object relational mapping - Relations - Inheritance - One table many classes.php
index 689114886..ffe77627a 100644
--- a/manual/docs/Object relational mapping - Relations - Inheritance - One table many classes.php
+++ b/manual/docs/Object relational mapping - Relations - Inheritance - One table many classes.php
@@ -5,3 +5,18 @@ The only thing we have to make is 3 records (Entity, Group and User).
+class Entity extends Doctrine_Record {
+ public function setTableDefinition() {
+ $this->hasColumn('name','string',30);
+ $this->hasColumn('username','string',20);
+ $this->hasColumn('password','string',16);
+ $this->hasColumn('created','integer',11);
+ }
+}
+
+class User extends Entity { }
+
+class Group extends Entity { }
+
diff --git a/manual/docs/Object relational mapping - Relations - Inheritance - One table one class.php b/manual/docs/Object relational mapping - Relations - Inheritance - One table one class.php
index 603eef0e8..4d27c8423 100644
--- a/manual/docs/Object relational mapping - Relations - Inheritance - One table one class.php
+++ b/manual/docs/Object relational mapping - Relations - Inheritance - One table one class.php
@@ -3,3 +3,30 @@ Users and groups are both entities.
The only thing we have to do is write 3 classes (Entity, Group and User) and make iterative
setTableDefinition method calls.
+class Entity extends Doctrine_Record {
+ public function setTableDefinition() {
+ $this->hasColumn('name','string',30);
+ $this->hasColumn('username','string',20);
+ $this->hasColumn('password','string',16);
+ $this->hasColumn('created','integer',11);
+ }
+}
+
+class User extends Entity {
+ public function setTableDefinition() {
+ // the following method call is needed in
+ // one-table-one-class inheritance
+ parent::setTableDefinition();
+ }
+}
+
+class Group extends Entity {
+ public function setTableDefinition() {
+ // the following method call is needed in
+ // one-table-one-class inheritance
+ parent::setTableDefinition();
+ }
+}
+
diff --git a/manual/docs/Object relational mapping - Relations - Introduction.php b/manual/docs/Object relational mapping - Relations - Introduction.php
index 8f3da94ca..37508325b 100644
--- a/manual/docs/Object relational mapping - Relations - Introduction.php
+++ b/manual/docs/Object relational mapping - Relations - Introduction.php
@@ -1,2 +1,3 @@
In Doctrine all record relations are being set with hasMany, hasOne, ownsMany and ownsOne methods. Doctrine supports almost any kind of database relation
from simple one-to-one foreign key relations to join table self-referencing relations.
+
diff --git a/manual/docs/Object relational mapping - Relations - Join table associations - Many-to-Many.php b/manual/docs/Object relational mapping - Relations - Join table associations - Many-to-Many.php
index 499adcd80..c651dd67f 100644
--- a/manual/docs/Object relational mapping - Relations - Join table associations - Many-to-Many.php
+++ b/manual/docs/Object relational mapping - Relations - Join table associations - Many-to-Many.php
@@ -12,3 +12,58 @@ this behoviour by setting the relations to association component (in this case G
In the following example we have Groups and Users of which relation is defined as
many-to-many. In this case we also need to define an additional class called Groupuser.
+
+
+class User extends Doctrine_Record {
+ public function setUp() {
+ $this->hasMany('Group','Groupuser.group_id');
+ }
+ public function setTableDefinition() {
+ $this->hasColumn('name','string',30);
+ }
+}
+
+class Group extends Doctrine_Record {
+ public function setUp() {
+ $this->hasMany('User','Groupuser.user_id');
+ }
+ public function setTableDefinition() {
+ $this->hasColumn('name','string',30);
+ }
+}
+
+class Groupuser extends Doctrine_Record {
+ public function setTableDefinition() {
+ $this->hasColumn('user_id','integer');
+ $this->hasColumn('group_id','integer');
+ }
+}
+
+
+$user = new User();
+
+// add two groups
+$user->Group[0]->name = 'First Group';
+
+$user->Group[1]->name = 'Second Group';
+
+// save changes into database
+$user->save();
+
+// deleting the associations between user and groups it belongs to
+
+$user->Groupuser->delete();
+
+$groups = new Doctrine_Collection($conn->getTable('Group'));
+
+$groups[0]->name = 'Third Group';
+
+$groups[1]->name = 'Fourth Group';
+
+$user->Group[2] = $groups[0];
+// $user will now have 3 groups
+
+$user->Group = $groups;
+// $user will now have two groups 'Third Group' and 'Fourth Group'
+
+
diff --git a/manual/docs/Object relational mapping - Relations - Join table associations - One-to-Many, Many-to-One.php b/manual/docs/Object relational mapping - Relations - Join table associations - One-to-Many, Many-to-One.php
index e69de29bb..8b1378917 100644
--- a/manual/docs/Object relational mapping - Relations - Join table associations - One-to-Many, Many-to-One.php
+++ b/manual/docs/Object relational mapping - Relations - Join table associations - One-to-Many, Many-to-One.php
@@ -0,0 +1 @@
+
diff --git a/manual/docs/Object relational mapping - Relations - Join table associations - One-to-One.php b/manual/docs/Object relational mapping - Relations - Join table associations - One-to-One.php
index e69de29bb..8b1378917 100644
--- a/manual/docs/Object relational mapping - Relations - Join table associations - One-to-One.php
+++ b/manual/docs/Object relational mapping - Relations - Join table associations - One-to-One.php
@@ -0,0 +1 @@
+
diff --git a/manual/docs/Object relational mapping - Relations - Join table associations - Self-referencing.php b/manual/docs/Object relational mapping - Relations - Join table associations - Self-referencing.php
index 7e41044c4..1ac461341 100644
--- a/manual/docs/Object relational mapping - Relations - Join table associations - Self-referencing.php
+++ b/manual/docs/Object relational mapping - Relations - Join table associations - Self-referencing.php
@@ -1 +1,18 @@
Self-referencing with join tables is done as follows:
+
+
+class User extends Doctrine_Record {
+ public function setUp() {
+ $this->hasMany('User as Friend','UserReference.user_id-user_id2');
+ }
+ public function setTableDefinition() {
+ $this->hasColumn('name','string',30);
+ }
+}
+class UserReference extends Doctrine_Record {
+ public function setTableDefinition() {
+ $this->hasColumn('user_id','integer');
+ $this->hasColumn('user_id2','integer');
+ }
+}
+
diff --git a/manual/docs/Object relational mapping - Relations - Relation aliases.php b/manual/docs/Object relational mapping - Relations - Relation aliases.php
index 6ba9c1515..b1acca309 100644
--- a/manual/docs/Object relational mapping - Relations - Relation aliases.php
+++ b/manual/docs/Object relational mapping - Relations - Relation aliases.php
@@ -1 +1,28 @@
Doctrine supports relation aliases through 'as' keyword.
+
+
+class Forum_Board extends Doctrine_Record {
+ public function setTableDefinition() {
+ $this->hasColumn('name', 'string', 100);
+ $this->hasColumn('description', 'string', 5000);
+ }
+ public function setUp() {
+ // notice the 'as' keyword here
+ $this->ownsMany('Forum_Thread as Threads', 'Forum_Thread.board_id');
+ }
+}
+
+class Forum_Thread extends Doctrine_Record {
+ public function setTableDefinition() {
+ $this->hasColumn('board_id', 'integer', 10);
+ $this->hasColumn('updated', 'integer', 10);
+ $this->hasColumn('closed', 'integer', 1);
+ }
+ public function setUp() {
+ // notice the 'as' keyword here
+ $this->hasOne('Forum_Board as Board', 'Forum_Thread.board_id');
+ }
+}
+$board = new Board();
+$board->Threads[0]->updated = time();
+
diff --git a/manual/docs/Object relational mapping - Table and class naming.php b/manual/docs/Object relational mapping - Table and class naming.php
index 4aa8d9883..3cb96d21d 100644
--- a/manual/docs/Object relational mapping - Table and class naming.php
+++ b/manual/docs/Object relational mapping - Table and class naming.php
@@ -16,3 +16,4 @@ Doctrine automatically creates table names from the record class names. For this
Example. My_PerfectClass
+class Forum_Category extends Doctrine_Record {
+ public function setTableDefinition() {
+ $this->hasColumn("root_category_id", "integer", 10);
+ $this->hasColumn("parent_category_id", "integer", 10);
+ $this->hasColumn("name", "string", 50);
+ $this->hasColumn("description", "string", 99999);
+ }
+ public function setUp() {
+ $this->hasMany("Forum_Category as Subcategory", "Subcategory.parent_category_id");
+ $this->hasOne("Forum_Category as Rootcategory", "Forum_Category.root_category_id");
+ }
+}
+class Forum_Board extends Doctrine_Record {
+ public function setTableDefinition() {
+ $this->hasColumn("category_id", "integer", 10);
+ $this->hasColumn("name", "string", 100);
+ $this->hasColumn("description", "string", 5000);
+ }
+ public function setUp() {
+ $this->hasOne("Forum_Category as Category", "Forum_Board.category_id");
+ $this->ownsMany("Forum_Thread as Threads", "Forum_Thread.board_id");
+ }
+}
+
+class Forum_Entry extends Doctrine_Record {
+ public function setTableDefinition() {
+ $this->hasColumn("author", "string", 50);
+ $this->hasColumn("topic", "string", 100);
+ $this->hasColumn("message", "string", 99999);
+ $this->hasColumn("parent_entry_id", "integer", 10);
+ $this->hasColumn("thread_id", "integer", 10);
+ $this->hasColumn("date", "integer", 10);
+ }
+ public function setUp() {
+ $this->hasOne("Forum_Entry as Parent", "Forum_Entry.parent_entry_id");
+ $this->hasOne("Forum_Thread as Thread", "Forum_Entry.thread_id");
+ }
+}
+
+class Forum_Thread extends Doctrine_Record {
+ public function setTableDefinition() {
+ $this->hasColumn("board_id", "integer", 10);
+ $this->hasColumn("updated", "integer", 10);
+ $this->hasColumn("closed", "integer", 1);
+ }
+ public function setUp() {
+ $this->hasOne("Forum_Board as Board", "Forum_Thread.board_id");
+ $this->ownsMany("Forum_Entry as Entries", "Forum_Entry.thread_id");
+ }
+}
+
diff --git a/manual/docs/Real world examples - User management system.php b/manual/docs/Real world examples - User management system.php
index 3ba1e772f..87e6f8c5a 100644
--- a/manual/docs/Real world examples - User management system.php
+++ b/manual/docs/Real world examples - User management system.php
@@ -19,3 +19,82 @@ In the following example we make a user management system where
9. When an entity is updated a current timestamp will be assigned to 'updated' field
+class Entity extends Doctrine_Record {
+ public function setUp() {
+ $this->ownsOne("Email","Entity.email_id");
+ $this->ownsMany("Phonenumber","Phonenumber.entity_id");
+ $this->setAttribute(Doctrine::ATTR_FETCHMODE,Doctrine::FETCH_BATCH);
+ $this->setAttribute(Doctrine::ATTR_LISTENER,new EntityListener());
+ }
+ public function setTableDefinition() {
+ $this->hasColumn("name","string",50);
+ $this->hasColumn("loginname","string",20);
+ $this->hasColumn("password","string",16);
+ $this->hasColumn("type","integer",1);
+ $this->hasColumn("created","integer",11);
+ $this->hasColumn("updated","integer",11);
+ $this->hasColumn("email_id","integer");
+ }
+}
+class Group extends Entity {
+ public function setUp() {
+ parent::setUp();
+ $this->hasMany("User","Groupuser.user_id");
+ $this->setInheritanceMap(array("type"=>1));
+ }
+}
+class User extends Entity {
+ public function setUp() {
+ parent::setUp();
+ $this->hasMany("Group","Groupuser.group_id");
+ $this->setInheritanceMap(array("type"=>0));
+ }
+}
+class Groupuser extends Doctrine_Record {
+ public function setTableDefinition() {
+ $this->hasColumn("group_id","integer");
+ $this->hasColumn("user_id","integer");
+ }
+}
+
+class Phonenumber extends Doctrine_Record {
+ public function setTableDefinition() {
+ $this->hasColumn("phonenumber","string",20);
+ $this->hasColumn("entity_id","integer");
+ }
+}
+class Email extends Doctrine_Record {
+ public function setTableDefinition() {
+ $this->hasColumn("address","string",150,"email|unique");
+ }
+}
+class EntityListener extends Doctrine_EventListener {
+ public function onPreUpdate(Doctrine_Record $record) {
+ $record->updated = time();
+ }
+ public function onPreInsert(Doctrine_Record $record) {
+ $record->created = time();
+ }
+}
+
+// USER MANAGEMENT SYSTEM IN ACTION:
+
+$manager = Doctrine_Manager::getInstance();
+
+$conn = $manager->openConnection(new PDO("DSN","username","password"));
+
+$user = new User();
+
+$user->name = "Jack Daniels";
+$user->Email->address = "jackdaniels@drinkmore.info";
+$user->Phonenumber[0]->phonenumber = "123 123";
+$user->Phonenumber[1]->phonenumber = "133 133";
+$user->save();
+
+$user->Group[0]->name = "beer lovers";
+$user->Group[0]->Email->address = "beerlovers@drinkmore.info";
+$user->Group[0]->save();
+
+
diff --git a/manual/docs/Runtime classes - Doctrine_Record.php b/manual/docs/Runtime classes - Doctrine_Record.php
index 488d59ab9..c05645e6c 100644
--- a/manual/docs/Runtime classes - Doctrine_Record.php
+++ b/manual/docs/Runtime classes - Doctrine_Record.php
@@ -1,2 +1,43 @@
Doctrine_Record is a wrapper for database row.
+
+
+$user = $table->find(2);
+
+// get state
+$state = $user->getState();
+
+print $user->name;
+
+print $user["name"];
+
+print $user->get("name");
+
+$user->name = "Jack Daniels";
+
+$user->set("name","Jack Daniels");
+
+// serialize record
+
+$serialized = serialize($user);
+
+$user = unserialize($serialized);
+
+// create a copy
+
+$copy = $user->copy();
+
+// get primary key
+
+$id = $user->getID();
+
+// print lots of useful info
+
+print $user;
+
+// save all the properties and composites
+$user->save();
+
+// delete this data access object and related objects
+$user->delete();
+
diff --git a/manual/docs/Runtime classes - Doctrine_Session.php b/manual/docs/Runtime classes - Doctrine_Session.php
index 3d9eb19e3..9bb515b4d 100644
--- a/manual/docs/Runtime classes - Doctrine_Session.php
+++ b/manual/docs/Runtime classes - Doctrine_Session.php
@@ -1,3 +1,34 @@
Doctrine_Connection is a wrapper for database connection. It creates Doctrine_Tables and keeps track of all the created tables.
Doctrine_Connection provides things that are missing from PDO like sequence support and limit/offset emulation.
+
+
+$sess = $manager->openConnection(Doctrine_Db::getConnection("schema://username:password@hostname/database"));
+
+// get connection state:
+switch($sess):
+ case Doctrine_Connection::STATE_BUSY:
+ // multiple open transactions
+ break;
+ case Doctrine_Connection::STATE_ACTIVE:
+ // one open transaction
+ break;
+ case Doctrine_Connection::STATE_CLOSED:
+ // closed state
+ break;
+ case Doctrine_Connection::STATE_OPEN:
+ // open state and zero open transactions
+ break;
+endswitch;
+
+// getting database handler
+
+$dbh = $sess->getDBH();
+
+// flushing the connection
+$sess->flush();
+
+
+// print lots of useful info about connection:
+print $sess;
+
diff --git a/manual/docs/Technology - Architecture.php b/manual/docs/Technology - Architecture.php
index f7611d5cb..d798b4c1c 100644
--- a/manual/docs/Technology - Architecture.php
+++ b/manual/docs/Technology - Architecture.php
@@ -13,3 +13,4 @@ Doctrine is divided into 3 main packages:
>> Doctrine ORM
+
diff --git a/manual/docs/Technology - Design patterns used.php b/manual/docs/Technology - Design patterns used.php
index 8ff792ee0..10c805c97 100644
--- a/manual/docs/Technology - Design patterns used.php
+++ b/manual/docs/Technology - Design patterns used.php
@@ -44,3 +44,4 @@ Enterprise application design patterns used:
+$conn->beginTransaction();
+
+$user = new User();
+$user->name = 'New user';
+$user->save();
+
+$user = $conn->getTable('User')->find(5);
+$user->name = 'Modified user';
+$user->save();
+
+$conn->commit(); // all the queries are executed here
+
diff --git a/manual/docs/Transactions - Isolation levels.php b/manual/docs/Transactions - Isolation levels.php
index 3651fa063..c939144a3 100644
--- a/manual/docs/Transactions - Isolation levels.php
+++ b/manual/docs/Transactions - Isolation levels.php
@@ -29,3 +29,4 @@ renderCode("getIsolation();
?>");
?>
+
diff --git a/manual/docs/Transactions - Lock modes.php b/manual/docs/Transactions - Lock modes.php
index e69de29bb..8b1378917 100644
--- a/manual/docs/Transactions - Lock modes.php
+++ b/manual/docs/Transactions - Lock modes.php
@@ -0,0 +1 @@
+
diff --git a/manual/docs/Transactions - Locking strategies - Optimistic locking.php b/manual/docs/Transactions - Locking strategies - Optimistic locking.php
index e69de29bb..8b1378917 100644
--- a/manual/docs/Transactions - Locking strategies - Optimistic locking.php
+++ b/manual/docs/Transactions - Locking strategies - Optimistic locking.php
@@ -0,0 +1 @@
+
diff --git a/manual/docs/Transactions - Locking strategies - Pessimistic locking.php b/manual/docs/Transactions - Locking strategies - Pessimistic locking.php
index e69de29bb..8b1378917 100644
--- a/manual/docs/Transactions - Locking strategies - Pessimistic locking.php
+++ b/manual/docs/Transactions - Locking strategies - Pessimistic locking.php
@@ -0,0 +1 @@
+
diff --git a/manual/docs/Transactions - Nesting.php b/manual/docs/Transactions - Nesting.php
index e69de29bb..8fa868563 100644
--- a/manual/docs/Transactions - Nesting.php
+++ b/manual/docs/Transactions - Nesting.php
@@ -0,0 +1,24 @@
+
+
+function saveUserAndGroup(Doctrine_Connection $conn, User $user, Group $group) {
+ $conn->beginTransaction();
+
+ $user->save();
+
+ $group->save();
+
+ $conn->commit();
+}
+
+try {
+ $conn->beginTransaction();
+
+ saveUserAndGroup($conn,$user,$group);
+ saveUserAndGroup($conn,$user2,$group2);
+ saveUserAndGroup($conn,$user3,$group3);
+
+ $conn->commit();
+} catch(Doctrine_Exception $e) {
+ $conn->rollback();
+}
+
diff --git a/manual/docs/Transactions - Savepoints.php b/manual/docs/Transactions - Savepoints.php
index 9bd027f28..f1016ac6b 100644
--- a/manual/docs/Transactions - Savepoints.php
+++ b/manual/docs/Transactions - Savepoints.php
@@ -54,3 +54,4 @@ try {
}
?>");
?>
+
diff --git a/manual/docs/Transactions - Unit of work.php b/manual/docs/Transactions - Unit of work.php
index e69de29bb..dc1336c43 100644
--- a/manual/docs/Transactions - Unit of work.php
+++ b/manual/docs/Transactions - Unit of work.php
@@ -0,0 +1,19 @@
+
+
+$conn->beginTransaction();
+
+$user = new User();
+$user->name = 'New user';
+$user->save();
+
+$user = $conn->getTable('User')->find(5);
+$user->name = 'Modified user';
+$user->save();
+
+
+$pending = $conn->getInserts(); // an array containing one element
+
+$pending = $conn->getUpdates(); // an array containing one element
+
+$conn->commit(); // all the queries are executed here
+
diff --git a/manual/docs/Working with objects - Component overview - Collection - Accessing elements.php b/manual/docs/Working with objects - Component overview - Collection - Accessing elements.php
index 1fe766630..4df4467d4 100644
--- a/manual/docs/Working with objects - Component overview - Collection - Accessing elements.php
+++ b/manual/docs/Working with objects - Component overview - Collection - Accessing elements.php
@@ -1 +1,17 @@
You can access the elements of Doctrine_Collection with set() and get() methods or with ArrayAccess interface.
+
+
+$table = $conn->getTable("User");
+
+$users = $table->findAll();
+
+// accessing elements with ArrayAccess interface
+
+$users[0]->name = "Jack Daniels";
+
+$users[1]->name = "John Locke";
+
+// accessing elements with get()
+
+print $users->get(1)->name;
+
diff --git a/manual/docs/Working with objects - Component overview - Collection - Adding new elements.php b/manual/docs/Working with objects - Component overview - Collection - Adding new elements.php
index 62239965f..b6b9eb11d 100644
--- a/manual/docs/Working with objects - Component overview - Collection - Adding new elements.php
+++ b/manual/docs/Working with objects - Component overview - Collection - Adding new elements.php
@@ -4,3 +4,12 @@ In the following example
we fetch all users from database (there are 5) and then add couple of users in the collection.
+$users = $table->findAll();
+
+print count($users); // 5
+
+$users[5]->name = "new user 1";
+$users[6]->name = "new user 2";
+
diff --git a/manual/docs/Working with objects - Component overview - Collection - Collection expanding.php b/manual/docs/Working with objects - Component overview - Collection - Collection expanding.php
index e69de29bb..8b1378917 100644
--- a/manual/docs/Working with objects - Component overview - Collection - Collection expanding.php
+++ b/manual/docs/Working with objects - Component overview - Collection - Collection expanding.php
@@ -0,0 +1 @@
+
diff --git a/manual/docs/Working with objects - Component overview - Collection - Deleting collection.php b/manual/docs/Working with objects - Component overview - Collection - Deleting collection.php
index b8776bc01..997b332e1 100644
--- a/manual/docs/Working with objects - Component overview - Collection - Deleting collection.php
+++ b/manual/docs/Working with objects - Component overview - Collection - Deleting collection.php
@@ -11,3 +11,11 @@ DELETE FROM phonenumber WHERE id IN (1,2,3, ... ,M)
+// delete all users with name 'John'
+
+$users = $table->findByDql("name LIKE '%John%'");
+
+$users->delete();
+
diff --git a/manual/docs/Working with objects - Component overview - Collection - Fetching strategies.php b/manual/docs/Working with objects - Component overview - Collection - Fetching strategies.php
index a03c5b11d..dc71711eb 100644
--- a/manual/docs/Working with objects - Component overview - Collection - Fetching strategies.php
+++ b/manual/docs/Working with objects - Component overview - Collection - Fetching strategies.php
@@ -40,3 +40,56 @@ SELECT id, name, type, created FROM user LIMIT 5 OFFSET 5
+$table = $conn->getTable("User");
+
+$table->setAttribute(Doctrine::ATTR_FETCHMODE, Doctrine::FETCH_IMMEDIATE);
+
+$users = $table->findAll();
+
+// or
+
+$users = $conn->query("FROM User-I"); // immediate collection
+
+foreach($users as $user) {
+ print $user->name;
+}
+
+
+$table->setAttribute(Doctrine::ATTR_FETCHMODE, Doctrine::FETCH_LAZY);
+
+$users = $table->findAll();
+
+// or
+
+$users = $conn->query("FROM User-L"); // lazy collection
+
+foreach($users as $user) {
+ print $user->name;
+}
+
+$table->setAttribute(Doctrine::ATTR_FETCHMODE, Doctrine::FETCH_BATCH);
+
+$users = $table->findAll();
+
+// or
+
+$users = $conn->query("FROM User-B"); // batch collection
+
+foreach($users as $user) {
+ print $user->name;
+}
+
+$table->setAttribute(Doctrine::ATTR_FETCHMODE, Doctrine::FETCH_OFFSET);
+
+$users = $table->findAll();
+
+// or
+
+$users = $conn->query("FROM User-O"); // offset collection
+
+foreach($users as $user) {
+ print $user->name;
+}
+
diff --git a/manual/docs/Working with objects - Component overview - Collection - Getting collection count.php b/manual/docs/Working with objects - Component overview - Collection - Getting collection count.php
index b69b6fad3..4485a1228 100644
--- a/manual/docs/Working with objects - Component overview - Collection - Getting collection count.php
+++ b/manual/docs/Working with objects - Component overview - Collection - Getting collection count.php
@@ -1 +1,11 @@
The Doctrine_Collection method count returns the number of elements currently in the collection.
+
+
+$users = $table->findAll();
+
+$users->count();
+
+// or
+
+count($users); // Doctrine_Collection implements Countable interface
+
diff --git a/manual/docs/Working with objects - Component overview - Collection - Introduction.php b/manual/docs/Working with objects - Component overview - Collection - Introduction.php
index d446c7a90..2a3cb2703 100644
--- a/manual/docs/Working with objects - Component overview - Collection - Introduction.php
+++ b/manual/docs/Working with objects - Component overview - Collection - Introduction.php
@@ -5,3 +5,22 @@ When fetching data from database with either DQL API (see Doctrine_Query) or raw
Doctrine_Collection by default.
+$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();
+
diff --git a/manual/docs/Working with objects - Component overview - Collection - Key mapping.php b/manual/docs/Working with objects - Component overview - Collection - Key mapping.php
index a8b9cf891..6a3c5ecb2 100644
--- a/manual/docs/Working with objects - Component overview - Collection - Key mapping.php
+++ b/manual/docs/Working with objects - Component overview - Collection - Key mapping.php
@@ -1,3 +1,35 @@
Sometimes you may not want to use normal indexing for collection elements. For example in
some cases mapping primary keys as collection keys might be useful. The following example
demonstrates how this can be achieved.
+
+
+// mapping id column
+
+$user = new User();
+
+$user->setAttribute(Doctrine::ATTR_COLL_KEY, 'id');
+
+// now user collections will use the values of
+// id column as element indexes
+
+$users = $user->getTable()->findAll();
+
+foreach($users as $id => $user) {
+ print $id . $user->name;
+}
+
+// mapping name column
+
+$user = new User();
+
+$user->setAttribute(Doctrine::ATTR_COLL_KEY, 'name');
+
+// now user collections will use the values of
+// name column as element indexes
+
+$users = $user->getTable()->findAll();
+
+foreach($users as $name => $user) {
+ print $name . $user->type;
+}
+
diff --git a/manual/docs/Working with objects - Component overview - Collection - Loading related records.php b/manual/docs/Working with objects - Component overview - Collection - Loading related records.php
index 24b8ebd42..1dfed0b19 100644
--- a/manual/docs/Working with objects - Component overview - Collection - Loading related records.php
+++ b/manual/docs/Working with objects - Component overview - Collection - Loading related records.php
@@ -1,3 +1,24 @@
Doctrine provides means for effiently retrieving all related records for all record elements. That means
when you have for example a collection of users you can load all phonenumbers for all users by simple calling
the loadRelated() method.
+
+
+$users = $conn->query("FROM User");
+
+// now lets load phonenumbers for all users
+
+$users->loadRelated("Phonenumber");
+
+foreach($users as $user) {
+ print $user->Phonenumber->phonenumber;
+ // no additional db queries needed here
+}
+
+// the loadRelated works an any relation, even associations:
+
+$users->loadRelated("Group");
+
+foreach($users as $user) {
+ print $user->Group->name;
+}
+
diff --git a/manual/docs/Working with objects - Component overview - Collection - Saving the collection.php b/manual/docs/Working with objects - Component overview - Collection - Saving the collection.php
index 0d937c242..cd4e65abb 100644
--- a/manual/docs/Working with objects - Component overview - Collection - Saving the collection.php
+++ b/manual/docs/Working with objects - Component overview - Collection - Saving the collection.php
@@ -1 +1,11 @@
As with records the collection can be saved by calling the save method.
+
+
+$users = $table->findAll();
+
+$users[0]->name = "Jack Daniels";
+
+$users[1]->name = "John Locke";
+
+$users->save();
+
diff --git a/manual/docs/Working with objects - Component overview - Connection - Available drivers.php b/manual/docs/Working with objects - Component overview - Connection - Available drivers.php
index 041a5033f..779829fdd 100644
--- a/manual/docs/Working with objects - Component overview - Connection - Available drivers.php
+++ b/manual/docs/Working with objects - Component overview - Connection - Available drivers.php
@@ -9,3 +9,4 @@ Doctrine has drivers for every PDO-supported database. The supported databases a
+$user = new User();
+$user->name = 'Jack';
+
+$group = $conn->create('Group');
+$group->name = 'Drinking Club';
+
+// saves all the changed objects into database
+
+$conn->flush();
+
diff --git a/manual/docs/Working with objects - Component overview - Connection - Getting a table object.php b/manual/docs/Working with objects - Component overview - Connection - Getting a table object.php
index 5a557e304..bddde1ff0 100644
--- a/manual/docs/Working with objects - Component overview - Connection - Getting a table object.php
+++ b/manual/docs/Working with objects - Component overview - Connection - Getting a table object.php
@@ -1 +1,13 @@
In order to get table object for specified record just call Doctrine_Record::getTable() or Doctrine_Connection::getTable().
+
+
+$manager = Doctrine_Manager::getInstance();
+
+// open new connection
+
+$conn = $manager->openConnection(new PDO('dsn','username','password'));
+
+// getting a table object
+
+$table = $conn->getTable('User');
+
diff --git a/manual/docs/Working with objects - Component overview - Connection - Getting connection state.php b/manual/docs/Working with objects - Component overview - Connection - Getting connection state.php
index 5d5ebcbe7..671a04b6d 100644
--- a/manual/docs/Working with objects - Component overview - Connection - Getting connection state.php
+++ b/manual/docs/Working with objects - Component overview - Connection - Getting connection state.php
@@ -1,2 +1,19 @@
Connection state gives you information about how active connection currently is. You can get the current state
by calling Doctrine_Connection::getState().
+
+
+switch($conn->getState()):
+ case Doctrine_Connection::STATE_ACTIVE:
+ // connection open and zero open transactions
+ break;
+ case Doctrine_Connection::STATE_ACTIVE:
+ // one open transaction
+ break;
+ case Doctrine_Connection::STATE_BUSY:
+ // multiple open transactions
+ break;
+ case Doctrine_Connection::STATE_CLOSED:
+ // connection closed
+ break;
+endswitch;
+
diff --git a/manual/docs/Working with objects - Component overview - Connection - Introduction.php b/manual/docs/Working with objects - Component overview - Connection - Introduction.php
index 9d62a2446..6e6dd9235 100644
--- a/manual/docs/Working with objects - Component overview - Connection - Introduction.php
+++ b/manual/docs/Working with objects - Component overview - Connection - Introduction.php
@@ -18,3 +18,5 @@ Doctrine_Connection is a wrapper for database connection. It handles several thi
full information of possible errors.
+
+
diff --git a/manual/docs/Working with objects - Component overview - Connection - Querying the database.php b/manual/docs/Working with objects - Component overview - Connection - Querying the database.php
index 62cab24de..030399e5c 100644
--- a/manual/docs/Working with objects - Component overview - Connection - Querying the database.php
+++ b/manual/docs/Working with objects - Component overview - Connection - Querying the database.php
@@ -1 +1,16 @@
Doctrine_Connection::query() is a simple method for efficient object retrieval. It takes one parameter (DQL query) and optionally prepared statement params.
+
+
+
+// select all users
+
+$users = $conn->query('FROM User');
+
+// select all users where user email is jackdaniels@drinkmore.info
+
+$users = $conn->query("FROM User WHERE User.Email.address = 'jackdaniels@drinkmore.info'");
+
+// using prepared statements
+
+$users = $conn->query('FROM User WHERE User.name = ?', array('Jack'));
+
diff --git a/manual/docs/Working with objects - Component overview - Db - Chaining listeners.php b/manual/docs/Working with objects - Component overview - Db - Chaining listeners.php
index af3cfa7b5..85fe6f671 100644
--- a/manual/docs/Working with objects - Component overview - Db - Chaining listeners.php
+++ b/manual/docs/Working with objects - Component overview - Db - Chaining listeners.php
@@ -5,3 +5,38 @@ For example you might want to add different aspects to your Doctrine_Db instance
caching, query profiling etc.
+
+// using PDO dsn for connecting sqlite memory table
+
+$dbh = Doctrine_Db::getConnection('sqlite::memory:');
+
+class Counter extends Doctrine_Db_EventListener {
+ private $queries = 0;
+
+ public function onQuery(Doctrine_Db_Event $event) {
+ $this->queries++;
+ }
+ public function count() {
+ return count($this->queries);
+ }
+}
+class OutputLogger extends Doctrine_Overloadable {
+ public function __call($m, $a) {
+ print $m." called!";
+ }
+}
+$counter = new Counter();
+
+$dbh->addListener($counter);
+$dbh->addListener(new OutputLogger());
+
+$dbh->query("SELECT * FROM foo");
+// prints:
+// onPreQuery called!
+// onQuery called!
+
+print $counter->count(); // 1
+
+
diff --git a/manual/docs/Working with objects - Component overview - Db - Connecting to a database.php b/manual/docs/Working with objects - Component overview - Db - Connecting to a database.php
index 7f160addf..670d2a3c0 100644
--- a/manual/docs/Working with objects - Component overview - Db - Connecting to a database.php
+++ b/manual/docs/Working with objects - Component overview - Db - Connecting to a database.php
@@ -54,3 +54,5 @@ try {
?>";
renderCode($str);
?>
+
+
diff --git a/manual/docs/Working with objects - Component overview - Db - Introduction.php b/manual/docs/Working with objects - Component overview - Db - Introduction.php
index a1b30849f..46e7fb65f 100644
--- a/manual/docs/Working with objects - Component overview - Db - Introduction.php
+++ b/manual/docs/Working with objects - Component overview - Db - Introduction.php
@@ -8,3 +8,4 @@ Doctrine_Db fits perfectly for application using for example page caching.
3. It has many short cuts for commonly used fetching methods like Doctrine_Db::fetchOne().
+
+// using PDO dsn for connecting sqlite memory table
+
+$dbh = Doctrine_Db::getConnection('sqlite::memory:');
+
+class MyLogger extends Doctrine_Db_EventListener {
+ public function onPreQuery(Doctrine_Db_Event $event) {
+ print "database is going to be queried!";
+ }
+ public function onQuery(Doctrine_Db_Event $event) {
+ print "executed: " . $event->getQuery();
+ }
+}
+
+$dbh->setListener(new MyLogger());
+
+$dbh->query("SELECT * FROM foo");
+// prints:
+// database is going to be queried
+// executed: SELECT * FROM foo
+
+
+class MyLogger2 extends Doctrine_Overloadable {
+ public function __call($m, $a) {
+ print $m." called!";
+ }
+}
+
+$dbh->setListener(new MyLogger2());
+
+$dbh->exec("DELETE FROM foo");
+// prints:
+// onPreExec called!
+// onExec called!
+
diff --git a/manual/docs/Working with objects - Component overview - Exceptions - List of exceptions.php b/manual/docs/Working with objects - Component overview - Exceptions - List of exceptions.php
index f0d55afd2..453f5fd76 100644
--- a/manual/docs/Working with objects - Component overview - Exceptions - List of exceptions.php
+++ b/manual/docs/Working with objects - Component overview - Exceptions - List of exceptions.php
@@ -22,3 +22,4 @@ Doctrine_Table_Exception thrown when user tries to initialize a ne
Doctrine_Mapping_Exception thrown when user tries to get a foreign key object but the mapping is not done right
+
diff --git a/manual/docs/Working with objects - Component overview - Exceptions - Overview.php b/manual/docs/Working with objects - Component overview - Exceptions - Overview.php
index e69de29bb..8b1378917 100644
--- a/manual/docs/Working with objects - Component overview - Exceptions - Overview.php
+++ b/manual/docs/Working with objects - Component overview - Exceptions - Overview.php
@@ -0,0 +1 @@
+
diff --git a/manual/docs/Working with objects - Component overview - Manager - Introduction.php b/manual/docs/Working with objects - Component overview - Manager - Introduction.php
index 18ebaf169..e6c4f534b 100644
--- a/manual/docs/Working with objects - Component overview - Manager - Introduction.php
+++ b/manual/docs/Working with objects - Component overview - Manager - Introduction.php
@@ -1 +1,2 @@
Doctrine_Manager is the heart of every Doctrine based application. Doctrine_Manager handles all connections (database connections).
+
diff --git a/manual/docs/Working with objects - Component overview - Manager - Managing connections.php b/manual/docs/Working with objects - Component overview - Manager - Managing connections.php
index 9c40720ab..b97a00edb 100644
--- a/manual/docs/Working with objects - Component overview - Manager - Managing connections.php
+++ b/manual/docs/Working with objects - Component overview - Manager - Managing connections.php
@@ -1,3 +1,29 @@
Switching between connections in Doctrine is very easy, you just call Doctrine_Manager::setCurrentConnection() method.
You can access the connection by calling Doctrine_Manager::getConnection() or Doctrine_Manager::getCurrentConnection() if you only
want to get the current connection.
+
+
+// Doctrine_Manager controls all the connections
+
+$manager = Doctrine_Manager::getInstance();
+
+// open first connection
+
+$conn = $manager->openConnection(new PDO('dsn','username','password'), 'connection 1');
+
+// open second connection
+
+$conn2 = $manager->openConnection(new PDO('dsn2','username2','password2'), 'connection 2');
+
+$manager->getCurrentConnection(); // $conn2
+
+$manager->setCurrentConnection('connection 1');
+
+$manager->getCurrentConnection(); // $conn
+
+// iterating through connections
+
+foreach($manager as $conn) {
+
+}
+
diff --git a/manual/docs/Working with objects - Component overview - Manager - Opening a new connection.php b/manual/docs/Working with objects - Component overview - Manager - Opening a new connection.php
index cdc125e62..4b3759813 100644
--- a/manual/docs/Working with objects - Component overview - Manager - Opening a new connection.php
+++ b/manual/docs/Working with objects - Component overview - Manager - Opening a new connection.php
@@ -1,3 +1,22 @@
In order to get your first application started you first
need to get an instance of Doctrine_Manager which handles all the connections (database connections).
The second thing to do is to open a new connection.
+
+
+// Doctrine_Manager controls all the connections
+
+$manager = Doctrine_Manager::getInstance();
+
+// Doctrine_Connection
+// a script may have multiple open connections
+// (= multiple database connections)
+$dbh = new PDO('dsn','username','password');
+$conn = $manager->openConnection();
+
+// or if you want to use Doctrine Doctrine_Db and its
+// performance monitoring capabilities
+
+$dsn = 'schema://username:password@dsn/dbname';
+$dbh = Doctrine_Db::getConnection($dsn);
+$conn = $manager->openConnection();
+
diff --git a/manual/docs/Working with objects - Component overview - Query - Aggregate functions.php b/manual/docs/Working with objects - Component overview - Query - Aggregate functions.php
index e69de29bb..f8ffe17ff 100644
--- a/manual/docs/Working with objects - Component overview - Query - Aggregate functions.php
+++ b/manual/docs/Working with objects - Component overview - Query - Aggregate functions.php
@@ -0,0 +1,16 @@
+
+
+$q = new Doctrine_Query();
+
+$q->from('User(COUNT(id))');
+
+// returns an array
+$a = $q->execute();
+
+// selecting multiple aggregate values:
+$q = new Doctrine_Query();
+
+$q->from('User(COUNT(id)).Phonenumber(MAX(phonenumber))');
+
+$a = $q->execute();
+
diff --git a/manual/docs/Working with objects - Component overview - Query - Bound parameters.php b/manual/docs/Working with objects - Component overview - Query - Bound parameters.php
index e69de29bb..9c47359e6 100644
--- a/manual/docs/Working with objects - Component overview - Query - Bound parameters.php
+++ b/manual/docs/Working with objects - Component overview - Query - Bound parameters.php
@@ -0,0 +1,7 @@
+
+
+$query->from("User")
+ ->where("User.name = ?");
+
+$query->execute(array('Jack Daniels'));
+
diff --git a/manual/docs/Working with objects - Component overview - Query - DQL - SQL conversion.php b/manual/docs/Working with objects - Component overview - Query - DQL - SQL conversion.php
index 58592aada..8c597c207 100644
--- a/manual/docs/Working with objects - Component overview - Query - DQL - SQL conversion.php
+++ b/manual/docs/Working with objects - Component overview - Query - DQL - SQL conversion.php
@@ -55,3 +55,4 @@ foreach($e as $line) {
renderQueries($str);
*/
?>
+
diff --git a/manual/docs/Working with objects - Component overview - Query - FROM - selecting tables.php b/manual/docs/Working with objects - Component overview - Query - FROM - selecting tables.php
index 0b6a273c8..28c9e48bf 100644
--- a/manual/docs/Working with objects - Component overview - Query - FROM - selecting tables.php
+++ b/manual/docs/Working with objects - Component overview - Query - FROM - selecting tables.php
@@ -17,3 +17,28 @@ renderCode("");
?>
+// find all groups
+
+$coll = $q->from("FROM Group");
+
+// find all users and user emails
+
+$coll = $q->from("FROM User u LEFT JOIN u.Email e");
+
+// find all users and user emails with only user name and
+// age + email address loaded
+
+$coll = $q->select('u.name, u.age, e.address')
+ ->from('FROM User u')
+ ->leftJoin('u.Email e')
+ ->execute();
+
+// find all users, user email and user phonenumbers
+
+$coll = $q->from('FROM User u')
+ ->innerJoin('u.Email e')
+ ->innerJoin('u.Phonenumber p')
+ ->execute();
+
diff --git a/manual/codes/Working with objects - Component overview - Query - Fetching strategies.php b/manual/docs/Working with objects - Component overview - Query - Fetching strategies.php
similarity index 89%
rename from manual/codes/Working with objects - Component overview - Query - Fetching strategies.php
rename to manual/docs/Working with objects - Component overview - Query - Fetching strategies.php
index 8654ac3b5..beb54fe92 100644
--- a/manual/codes/Working with objects - Component overview - Query - Fetching strategies.php
+++ b/manual/docs/Working with objects - Component overview - Query - Fetching strategies.php
@@ -1,4 +1,5 @@
-
// select all users and load the data directly (Immediate fetching strategy)
$coll = $conn->query("FROM User-I");
@@ -22,4 +23,4 @@ $coll = $conn->query("FROM User-L");
// or
$coll = $conn->query("FROM User-LAZY");
-?>
+
diff --git a/manual/docs/Working with objects - Component overview - Query - HAVING conditions.php b/manual/docs/Working with objects - Component overview - Query - HAVING conditions.php
index 1fb8206e4..413e320ec 100644
--- a/manual/docs/Working with objects - Component overview - Query - HAVING conditions.php
+++ b/manual/docs/Working with objects - Component overview - Query - HAVING conditions.php
@@ -12,3 +12,4 @@ renderCode("having('COUNT(p.id) > 3');
?>");
?>
+
diff --git a/manual/docs/Working with objects - Component overview - Query - Introduction.php b/manual/docs/Working with objects - Component overview - Query - Introduction.php
index a798f91b7..9294fd6bd 100644
--- a/manual/docs/Working with objects - Component overview - Query - Introduction.php
+++ b/manual/docs/Working with objects - Component overview - Query - Introduction.php
@@ -7,3 +7,16 @@ For more info about DQL see the actual DQL chapter.
Doctrine_Query along with Doctrine_Expression provide an easy-to-use wrapper for writing DQL queries. Creating a new
query object can be done by either using the new operator or by calling create method. The create method exists for allowing easy
method call chaining.
+
+
+// initalizing a new Doctrine_Query (using the current connection)
+$q = new Doctrine_Query();
+
+// initalizing a new Doctrine_Query (using custom connection parameter)
+// here $conn is an instance of Doctrine_Connection
+$q = new Doctrine_Query($conn);
+
+// an example using the create method
+// here we simple fetch all users
+$users = Doctrine_Query::create()->from('User')->execute();
+
diff --git a/manual/docs/Working with objects - Component overview - Query - LIMIT and OFFSET - limiting the query results.php b/manual/docs/Working with objects - Component overview - Query - LIMIT and OFFSET - limiting the query results.php
index e69de29bb..ffd0993fc 100644
--- a/manual/docs/Working with objects - Component overview - Query - LIMIT and OFFSET - limiting the query results.php
+++ b/manual/docs/Working with objects - Component overview - Query - LIMIT and OFFSET - limiting the query results.php
@@ -0,0 +1,14 @@
+
+
+
+// find the first ten users and associated emails
+
+$q = new Doctrine_Query();
+
+$coll = $q->from('User u LEFT JOIN u.Email e')->limit(10);
+
+// find the first ten users starting from the user number 5
+
+$coll = $q->from('User u')->limit(10)->offset(5);
+
+
diff --git a/manual/codes/Working with objects - Component overview - Query - Lazy property fetching.php b/manual/docs/Working with objects - Component overview - Query - Lazy property fetching.php
similarity index 77%
rename from manual/codes/Working with objects - Component overview - Query - Lazy property fetching.php
rename to manual/docs/Working with objects - Component overview - Query - Lazy property fetching.php
index 28660b72e..2608e2c30 100644
--- a/manual/codes/Working with objects - Component overview - Query - Lazy property fetching.php
+++ b/manual/docs/Working with objects - Component overview - Query - Lazy property fetching.php
@@ -1,6 +1,7 @@
-
// retrieve all users with only their properties id and name loaded
$users = $conn->query("FROM User(id, name)");
-?>
+
diff --git a/manual/docs/Working with objects - Component overview - Query - Method overloading.php b/manual/docs/Working with objects - Component overview - Query - Method overloading.php
index 1dfc1c89e..7118ce5e1 100644
--- a/manual/docs/Working with objects - Component overview - Query - Method overloading.php
+++ b/manual/docs/Working with objects - Component overview - Query - Method overloading.php
@@ -1 +1,22 @@
You can overload the query object by calling the dql query parts as methods.
+
+
+$conn = Doctrine_Manager::getInstance()->openConnection(new PDO("dsn","username","password"));
+
+$query = new Doctrine_Query($conn);
+
+$query->from("User-b")
+ ->where("User.name LIKE 'Jack%'")
+ ->orderby("User.created")
+ ->limit(5);
+
+$users = $query->execute();
+
+$query->from("User.Group.Phonenumber")
+ ->where("User.Group.name LIKE 'Actors%'")
+ ->orderby("User.name")
+ ->limit(10)
+ ->offset(5);
+
+$users = $query->execute();
+
diff --git a/manual/docs/Working with objects - Component overview - Query - ORDER BY - sorting query results.php b/manual/docs/Working with objects - Component overview - Query - ORDER BY - sorting query results.php
index 642ec5d6e..0256f2273 100644
--- a/manual/docs/Working with objects - Component overview - Query - ORDER BY - sorting query results.php
+++ b/manual/docs/Working with objects - Component overview - Query - ORDER BY - sorting query results.php
@@ -1 +1,22 @@
ORDER BY - part works in much same way as SQL ORDER BY.
+
+
+$q = new Doctrine_Query();
+
+// find all users, sort by name descending
+
+$users = $q->from('User u')->orderby('u.name DESC');
+
+// find all users sort by name ascending
+
+$users = $q->from('User u')->orderby('u.name ASC');
+
+// find all users and their emails, sort by email address in ascending order
+
+$users = $q->from('User u')->leftJoin('u.Email e')->orderby('e.address');
+
+// find all users and their emails, sort by user name and email address
+
+$users = $q->from('User u')->leftJoin('u.Email e')
+ ->addOrderby('u.name')->addOrderby('e.address');
+
diff --git a/manual/docs/Working with objects - Component overview - Query - Relation operators.php b/manual/docs/Working with objects - Component overview - Query - Relation operators.php
index 1ebde18d7..a9aabdde7 100644
--- a/manual/docs/Working with objects - Component overview - Query - Relation operators.php
+++ b/manual/docs/Working with objects - Component overview - Query - Relation operators.php
@@ -5,3 +5,19 @@ for SQL INNER JOINs. Basically you should use dot operator if you want for examp
to select all users and their phonenumbers AND it doesn't matter if the users actually have any phonenumbers.
+$query->from('User u')->innerJoin('u.Email e');
+
+$query->execute();
+
+// executed SQL query:
+// SELECT ... FROM user INNER JOIN email ON ...
+
+$query->from('User u')->leftJoin('u.Email e');
+
+$query->execute();
+
+// executed SQL query:
+// SELECT ... FROM user LEFT JOIN email ON ...
+
diff --git a/manual/docs/Working with objects - Component overview - Query - WHERE - setting query conditions.php b/manual/docs/Working with objects - Component overview - Query - WHERE - setting query conditions.php
index 07f71049c..b92f2f9f3 100644
--- a/manual/docs/Working with objects - Component overview - Query - WHERE - setting query conditions.php
+++ b/manual/docs/Working with objects - Component overview - Query - WHERE - setting query conditions.php
@@ -57,3 +57,5 @@ renderCode("where(\"u.name LIKE '%Jack%' OR u.name LIKE '%John%') AND e.address LIKE '%@drinkmore.info'\");
?>");
?>
+
+
diff --git a/manual/docs/Working with objects - Component overview - RawSql - Adding components.php b/manual/docs/Working with objects - Component overview - RawSql - Adding components.php
index 39919f33e..8f30e9f5f 100644
--- a/manual/docs/Working with objects - Component overview - RawSql - Adding components.php
+++ b/manual/docs/Working with objects - Component overview - RawSql - Adding components.php
@@ -4,3 +4,17 @@ wrap all the columns in curly brackets but we also specify what tables associate
First we specify that table entity maps to record class 'Entity'
+$query = new Doctrine_RawSql($conn);
+
+$query->parseQuery("SELECT {entity.*}, {phonenumber.*}
+ FROM entity
+ LEFT JOIN phonenumber
+ ON phonenumber.entity_id = entity.id");
+
+$query->addComponent("entity", "Entity");
+$query->addComponent("phonenumber", "Entity.Phonenumber");
+
+$entities = $query->execute();
+
diff --git a/manual/docs/Working with objects - Component overview - RawSql - Introduction.php b/manual/docs/Working with objects - Component overview - RawSql - Introduction.php
index 2deb1d519..b342e3b41 100644
--- a/manual/docs/Working with objects - Component overview - RawSql - Introduction.php
+++ b/manual/docs/Working with objects - Component overview - RawSql - Introduction.php
@@ -2,3 +2,4 @@ In Doctrine you may express your queries in the native SQL dialect of your datab
This is useful if you want to use the full power of your database vendor's features (like query hints or the CONNECT keyword in Oracle).
+$query = new Doctrine_RawSql($conn);
+
+$query->select('{entity.name}')
+ ->from('entity');
+
+$query->addComponent("entity", "User");
+
+$coll = $query->execute();
+
diff --git a/manual/docs/Working with objects - Component overview - RawSql - Using SQL.php b/manual/docs/Working with objects - Component overview - RawSql - Using SQL.php
index 5bc392372..a22567f39 100644
--- a/manual/docs/Working with objects - Component overview - RawSql - Using SQL.php
+++ b/manual/docs/Working with objects - Component overview - RawSql - Using SQL.php
@@ -8,3 +8,11 @@ $q->parseQuery(). There are some differences though:
The following example represents a very simple case where no addComponent() calls are needed.
Here we select all entities from table entity with all the columns loaded in the records.
+
+
+$query = new Doctrine_RawSql($conn);
+
+$query->parseQuery("SELECT {entity.name} FROM entity");
+
+$entities = $query->execute();
+
diff --git a/manual/docs/Working with objects - Component overview - Record - Accessing properties.php b/manual/docs/Working with objects - Component overview - Record - Accessing properties.php
index 1ac201eb1..54c744d9c 100644
--- a/manual/docs/Working with objects - Component overview - Record - Accessing properties.php
+++ b/manual/docs/Working with objects - Component overview - Record - Accessing properties.php
@@ -1,3 +1,25 @@
You can retrieve existing objects (database rows) with Doctrine_Table or Doctrine_Connection.
Doctrine_Table provides simple methods like findBySql, findAll and find for finding objects whereas
Doctrine_Connection provides complete OQL API for retrieving objects (see chapter 9).
+
+
+$user = $table->find(3);
+
+// access property through overloading
+
+$name = $user->name;
+
+// access property with get()
+
+$name = $user->get("name");
+
+// access property with ArrayAccess interface
+
+$name = $user['name'];
+
+// iterating through properties
+
+foreach($user as $key => $value) {
+
+}
+
diff --git a/manual/docs/Working with objects - Component overview - Record - Callbacks.php b/manual/docs/Working with objects - Component overview - Record - Callbacks.php
index e69de29bb..8b1378917 100644
--- a/manual/docs/Working with objects - Component overview - Record - Callbacks.php
+++ b/manual/docs/Working with objects - Component overview - Record - Callbacks.php
@@ -0,0 +1 @@
+
diff --git a/manual/docs/Working with objects - Component overview - Record - Checking Existence.php b/manual/docs/Working with objects - Component overview - Record - Checking Existence.php
index e69de29bb..a3cb7fab4 100644
--- a/manual/docs/Working with objects - Component overview - Record - Checking Existence.php
+++ b/manual/docs/Working with objects - Component overview - Record - Checking Existence.php
@@ -0,0 +1,11 @@
+
+
+$record = new User();
+
+$record->exists(); // false
+
+$record->name = 'someone';
+$record->save();
+
+$record->exists(); // true
+
diff --git a/manual/docs/Working with objects - Component overview - Record - Creating new records.php b/manual/docs/Working with objects - Component overview - Record - Creating new records.php
index efd35dc19..28816254e 100644
--- a/manual/docs/Working with objects - Component overview - Record - Creating new records.php
+++ b/manual/docs/Working with objects - Component overview - Record - Creating new records.php
@@ -1,3 +1,24 @@
There are couple of ways for creating new records. Propably the easiest is using
native php new -operator. The other ways are calling Doctrine_Table::create() or Doctrine_Connection::create().
The last two exists only for backward compatibility. The recommended way of creating new objects is the new operator.
+
+
+$user = $conn->create("User");
+
+// alternative way:
+
+$table = $conn->getTable("User");
+
+$user = $table->create();
+
+// the simpliest way:
+
+$user = new User();
+
+
+// records support array access
+$user["name"] = "John Locke";
+
+// save user into database
+$user->save();
+
diff --git a/manual/docs/Working with objects - Component overview - Record - Deleting records.php b/manual/docs/Working with objects - Component overview - Record - Deleting records.php
index f70a095e3..31d99e38f 100644
--- a/manual/docs/Working with objects - Component overview - Record - Deleting records.php
+++ b/manual/docs/Working with objects - Component overview - Record - Deleting records.php
@@ -1,2 +1,19 @@
Deleting records in Doctrine is handled by Doctrine_Record::delete(), Doctrine_Collection::delete() and
Doctrine_Connection::delete() methods.
+
+
+$table = $conn->getTable("User");
+
+$user = $table->find(2);
+
+// deletes user and all related composite objects
+if($user !== false)
+ $user->delete();
+
+
+$users = $table->findAll();
+
+
+// delete all users and their related composite objects
+$users->delete();
+
diff --git a/manual/docs/Working with objects - Component overview - Record - Getting object copy.php b/manual/docs/Working with objects - Component overview - Record - Getting object copy.php
index 89858805f..ff008f2ec 100644
--- a/manual/docs/Working with objects - Component overview - Record - Getting object copy.php
+++ b/manual/docs/Working with objects - Component overview - Record - Getting object copy.php
@@ -1,2 +1,6 @@
Sometimes you may want to get a copy of your object (a new object with all properties copied).
Doctrine provides a simple method for this: Doctrine_Record::copy().
+
+
+$copy = $user->copy();
+
diff --git a/manual/docs/Working with objects - Component overview - Record - Getting record state.php b/manual/docs/Working with objects - Component overview - Record - Getting record state.php
index dc9a5c9d3..76d130cea 100644
--- a/manual/docs/Working with objects - Component overview - Record - Getting record state.php
+++ b/manual/docs/Working with objects - Component overview - Record - Getting record state.php
@@ -5,3 +5,35 @@ has a state called proxy.
+$state = $record->getState();
+
+switch($state):
+ case Doctrine_Record::STATE_PROXY:
+ // record is in proxy state,
+ // meaning its persistent but not all of its properties are
+ // loaded from the database
+ break;
+ case Doctrine_Record::STATE_TCLEAN:
+ // record is transient clean,
+ // meaning its transient and
+ // none of its properties are changed
+ break;
+ case Doctrine_Record::STATE_TDIRTY:
+ // record is transient dirty,
+ // meaning its transient and
+ // some of its properties are changed
+ break;
+ case Doctrine_Record::STATE_DIRTY:
+ // record is dirty,
+ // meaning its persistent and
+ // some of its properties are changed
+ break;
+ case Doctrine_Record::STATE_CLEAN:
+ // record is clean,
+ // meaning its persistent and
+ // none of its properties are changed
+ break;
+endswitch;
+
diff --git a/manual/docs/Working with objects - Component overview - Record - Introduction.php b/manual/docs/Working with objects - Component overview - Record - Introduction.php
index fc6dc682f..9e1fa695e 100644
--- a/manual/docs/Working with objects - Component overview - Record - Introduction.php
+++ b/manual/docs/Working with objects - Component overview - Record - Introduction.php
@@ -2,3 +2,4 @@ Doctrine_Record is a wrapper for database row but along with that it speficies w
on other components and what columns it has. It may access the related components, hence its refered as an ActiveRecord.
+$table = $conn->getTable("User");
+
+// find by primary key
+
+$user = $table->find(2);
+if($user !== false)
+ print $user->name;
+
+// get all users
+foreach($table->findAll() as $user) {
+ print $user->name;
+}
+
+// finding by dql
+foreach($table->findByDql("name LIKE '%John%'") as $user) {
+ print $user->created;
+}
+
+// finding objects with DQL
+
+$users = $conn->query("FROM User WHERE User.name LIKE '%John%'");
+
diff --git a/manual/docs/Working with objects - Component overview - Record - Serializing.php b/manual/docs/Working with objects - Component overview - Record - Serializing.php
index 45a642d0c..ca505e906 100644
--- a/manual/docs/Working with objects - Component overview - Record - Serializing.php
+++ b/manual/docs/Working with objects - Component overview - Record - Serializing.php
@@ -1,2 +1,8 @@
Sometimes you may want to serialize your record objects (possibly for caching purposes). Records can be serialized,
but remember: Doctrine cleans all relations, before doing this. So remember to persist your objects into database before serializing them.
+
+
+$string = serialize($user);
+
+$user = unserialize($string);
+
diff --git a/manual/docs/Working with objects - Component overview - Record - Updating records.php b/manual/docs/Working with objects - Component overview - Record - Updating records.php
index 5194632e3..c68b264ed 100644
--- a/manual/docs/Working with objects - Component overview - Record - Updating records.php
+++ b/manual/docs/Working with objects - Component overview - Record - Updating records.php
@@ -1,3 +1,16 @@
Updating objects is very easy, you just call the Doctrine_Record::save() method. The other way
(perhaps even easier) is to call Doctrine_Connection::flush() which saves all objects. It should be noted though
that flushing is a much heavier operation than just calling save method.
+
+
+$table = $conn->getTable("User");
+
+
+$user = $table->find(2);
+
+if($user !== false) {
+ $user->name = "Jack Daniels";
+
+ $user->save();
+}
+
diff --git a/manual/docs/Working with objects - Component overview - Table - Custom finders.php b/manual/docs/Working with objects - Component overview - Table - Custom finders.php
index 000badb0b..bed97fb58 100644
--- a/manual/docs/Working with objects - Component overview - Table - Custom finders.php
+++ b/manual/docs/Working with objects - Component overview - Table - Custom finders.php
@@ -1,2 +1,27 @@
You can add custom finder methods to your custom table object. These finder methods may use fast
Doctrine_Table finder methods or DQL API (Doctrine_Connection::query()).
+
+
+class UserTable extends Doctrine_Table {
+ /**
+ * you can add your own finder methods here
+ */
+ public function findByName($name) {
+ return $this->getConnection()->query("FROM User WHERE name LIKE '%$name%'");
+ }
+}
+class User extends Doctrine_Record { }
+
+$conn = Doctrine_Manager::getInstance()
+ ->openConnection(new PDO("dsn","username","password"));
+
+// doctrine will now check if a class called UserTable exists
+// and if it inherits Doctrine_Table
+
+$table = $conn->getTable("User");
+
+print get_class($table); // UserTable
+
+$users = $table->findByName("Jack");
+
+
diff --git a/manual/docs/Working with objects - Component overview - Table - Custom table classes.php b/manual/docs/Working with objects - Component overview - Table - Custom table classes.php
index f267c2ac9..836902abd 100644
--- a/manual/docs/Working with objects - Component overview - Table - Custom table classes.php
+++ b/manual/docs/Working with objects - Component overview - Table - Custom table classes.php
@@ -1,2 +1,16 @@
Adding custom table classes is very easy. Only thing you need to do is name the classes as [componentName]Table and make them
inherit Doctrine_Table.
+
+
+
+// valid table object
+
+class UserTable extends Doctrine_Table {
+
+}
+
+// not valid [doesn't extend Doctrine_Table]
+class GroupTable { }
+
+
+
diff --git a/manual/docs/Working with objects - Component overview - Table - Finder methods.php b/manual/docs/Working with objects - Component overview - Table - Finder methods.php
index b3198484e..c1e041d77 100644
--- a/manual/docs/Working with objects - Component overview - Table - Finder methods.php
+++ b/manual/docs/Working with objects - Component overview - Table - Finder methods.php
@@ -1,2 +1,24 @@
Doctrine_Table provides basic finder methods. These finder methods are very fast and should be used if you only need to fetch
data from one database table. If you need queries that use several components (database tables) use Doctrine_Connection::query().
+
+
+$table = $conn->getTable("User");
+
+// find by primary key
+
+$user = $table->find(2);
+
+if($user !== false)
+ print $user->name;
+
+
+// get all users
+foreach($table->findAll() as $user) {
+ print $user->name;
+}
+
+// finding by dql
+foreach($table->findByDql("name LIKE '%John%'") as $user) {
+ print $user->created;
+}
+
diff --git a/manual/docs/Working with objects - Component overview - Table - Getting relation objects.php b/manual/docs/Working with objects - Component overview - Table - Getting relation objects.php
index e69de29bb..8b1378917 100644
--- a/manual/docs/Working with objects - Component overview - Table - Getting relation objects.php
+++ b/manual/docs/Working with objects - Component overview - Table - Getting relation objects.php
@@ -0,0 +1 @@
+
diff --git a/manual/docs/Working with objects - Component overview - Table - Getting table information.php b/manual/docs/Working with objects - Component overview - Table - Getting table information.php
index e69de29bb..762f16b1e 100644
--- a/manual/docs/Working with objects - Component overview - Table - Getting table information.php
+++ b/manual/docs/Working with objects - Component overview - Table - Getting table information.php
@@ -0,0 +1,12 @@
+
+
+$table = $conn->getTable('User');
+
+// getting column names
+
+$names = $table->getColumnNames();
+
+// getting column information
+
+$columns = $table->getColumns();
+
diff --git a/manual/docs/Working with objects - Component overview - Table - Introduction.php b/manual/docs/Working with objects - Component overview - Table - Introduction.php
index e69de29bb..8b1378917 100644
--- a/manual/docs/Working with objects - Component overview - Table - Introduction.php
+++ b/manual/docs/Working with objects - Component overview - Table - Introduction.php
@@ -0,0 +1 @@
+
diff --git a/manual/docs/Working with objects - Dealing with relations - Creating related records.php b/manual/docs/Working with objects - Dealing with relations - Creating related records.php
index 6955476a6..07bbd529b 100644
--- a/manual/docs/Working with objects - Dealing with relations - Creating related records.php
+++ b/manual/docs/Working with objects - Dealing with relations - Creating related records.php
@@ -1 +1,16 @@
When accessing related records and if those records do not exists Doctrine automatically creates new records.
+
+
+// NOTE: related record have always the first letter in uppercase
+$email = $user->Email;
+
+$email->address = 'jackdaniels@drinkmore.info';
+
+$user->save();
+
+// alternative:
+
+$user->Email->address = 'jackdaniels@drinkmore.info';
+
+$user->save();
+
diff --git a/manual/docs/Working with objects - Dealing with relations - Deleting related records.php b/manual/docs/Working with objects - Dealing with relations - Deleting related records.php
index 37f75d0c2..56156563c 100644
--- a/manual/docs/Working with objects - Dealing with relations - Deleting related records.php
+++ b/manual/docs/Working with objects - Dealing with relations - Deleting related records.php
@@ -1,2 +1,12 @@
You can delete related records individually be calling delete() on each record. If you want to delete a whole record graph just call
delete on the owner record.
+
+
+$user->Email->delete();
+
+$user->Phonenumber[3]->delete();
+
+// deleting user and all related objects:
+
+$user->delete();
+
diff --git a/manual/docs/Working with objects - Dealing with relations - Retrieving related records.php b/manual/docs/Working with objects - Dealing with relations - Retrieving related records.php
index 903277284..43ffb533f 100644
--- a/manual/docs/Working with objects - Dealing with relations - Retrieving related records.php
+++ b/manual/docs/Working with objects - Dealing with relations - Retrieving related records.php
@@ -1,2 +1,10 @@
You can retrieve related records by the very same Doctrine_Record methods you've already propably used for accessing record properties.
When accessing related record you just simply use the class names.
+
+
+print $user->Email['address'];
+
+print $user->Phonenumber[0]->phonenumber;
+
+print $user->Group[0]->name;
+
diff --git a/manual/docs/Working with objects - Dealing with relations - Updating related records.php b/manual/docs/Working with objects - Dealing with relations - Updating related records.php
index 687028d7d..9eab04af0 100644
--- a/manual/docs/Working with objects - Dealing with relations - Updating related records.php
+++ b/manual/docs/Working with objects - Dealing with relations - Updating related records.php
@@ -1,2 +1,12 @@
You can update the related records by calling save for each related object / collection individually or by calling
save on the object that owns the other objects. You can also call Doctrine_Connection::flush which saves all pending objects.
+
+
+$user->Email['address'] = 'koskenkorva@drinkmore.info';
+
+$user->Phonenumber[0]->phonenumber = '123123';
+
+$user->save();
+
+// saves the email and phonenumber
+
diff --git a/manual/docs/Working with objects - Dealing with relations - Working with associations.php b/manual/docs/Working with objects - Dealing with relations - Working with associations.php
index e69de29bb..8b1378917 100644
--- a/manual/docs/Working with objects - Dealing with relations - Working with associations.php
+++ b/manual/docs/Working with objects - Dealing with relations - Working with associations.php
@@ -0,0 +1 @@
+