From 487e07aea630376cb5419d21fa4a3a942b2fe2c2 Mon Sep 17 00:00:00 2001 From: zYne Date: Fri, 29 Sep 2006 11:17:16 +0000 Subject: [PATCH] added DQL introduction --- ...octrine Query Language) - Introduction.php | 26 +++++++++++++++++++ ...octrine Query Language) - Introduction.php | 19 ++++++++++++++ manual/documentation.php | 5 +++- manual/styles/basic.css | 3 +++ 4 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 manual/codes/DQL (Doctrine Query Language) - Introduction.php create mode 100644 manual/docs/DQL (Doctrine Query Language) - Introduction.php diff --git a/manual/codes/DQL (Doctrine Query Language) - Introduction.php b/manual/codes/DQL (Doctrine Query Language) - Introduction.php new file mode 100644 index 000000000..223c0a623 --- /dev/null +++ b/manual/codes/DQL (Doctrine Query Language) - Introduction.php @@ -0,0 +1,26 @@ +getTable('User')->findAll(); + +foreach($users as $user) { + print $user->name."
"; + 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/docs/DQL (Doctrine Query Language) - Introduction.php b/manual/docs/DQL (Doctrine Query Language) - Introduction.php new file mode 100644 index 000000000..578aee195 --- /dev/null +++ b/manual/docs/DQL (Doctrine Query Language) - Introduction.php @@ -0,0 +1,19 @@ +Doctrine Query Language(DQL) is an Object Query Language created for helping users in complex object retrieval. +You should always consider using DQL(or raw SQL) when retrieving relational data efficiently (eg. when fetching users and their phonenumbers). +

+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. diff --git a/manual/documentation.php b/manual/documentation.php index ed28144a7..8f56dfff9 100644 --- a/manual/documentation.php +++ b/manual/documentation.php @@ -298,7 +298,10 @@ $menu = array("Getting started" => */ ), "DQL (Doctrine Query Language)" => - array('Syntax' => + + array('Introduction', + 'Syntax' => + array( 'FROM', 'WHERE', diff --git a/manual/styles/basic.css b/manual/styles/basic.css index f3170e566..a9ad74b05 100644 --- a/manual/styles/basic.css +++ b/manual/styles/basic.css @@ -42,6 +42,9 @@ color: #367FAC; a.big { font-size: 14 px; } +i { +color: #367FAC; +} a { color: #367FAC; }