Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
e647cdbb
Commit
e647cdbb
authored
Sep 29, 2007
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
--no commit message
--no commit message
parent
4eee98d5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
12 deletions
+16
-12
introduction.txt
.../new/docs/en/dql-doctrine-query-language/introduction.txt
+16
-12
No files found.
manual/new/docs/en/dql-doctrine-query-language/introduction.txt
View file @
e647cdbb
...
...
@@ -10,32 +10,36 @@ 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.
You may already be familiar with the following syntax:
<code type="php">
// DO NOT USE THE FOLLOWING CODE
// (us
ing many sql queries for object population):
// DO NOT USE THE FOLLOWING CODE
// (us
es many sql queries for object population)
$users = $conn->getTable('User')->findAll();
foreach($users as $user) {
print $user->name
."
";
print $user->name
. ' has phonenumbers: ';
foreach($user->Phonenumber as $phonenumber) {
print $phonenumber."
";
print $phonenumber . ' ';
}
}
<code>
However you should not use it. Above is the same behaviour implemented much more efficiently:
// same thing implemented much more efficiently:
<code type="php">
// same thing implemented much more efficiently:
// (using only one sql query for object population)
$users = $conn->query(
"FROM User.Phonenumber"
);
$users = $conn->query(
'FROM User u LEFT JOIN u.Phonenumber p'
);
foreach($users as $user) {
print $user->name
."
";
print $user->name
. ' has phonenumbers: ';
foreach($user->Phonenumber as $phonenumber) {
print $phonenumber."
";
print $phonenumber . ' ';
}
}
</code>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment