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
abb56d4f
Commit
abb56d4f
authored
Dec 15, 2006
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Docs updated
parent
99e81586
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
347 additions
and
345 deletions
+347
-345
Basic Components - Query - FROM - selecting tables.php
...es/Basic Components - Query - FROM - selecting tables.php
+2
-2
Basic Components - Query - Introduction.php
manual/codes/Basic Components - Query - Introduction.php
+4
-0
Basic Components - Query - ORDER BY - sorting query results.php
...Components - Query - ORDER BY - sorting query results.php
+8
-9
Basic Components - Query - DQL - SQL conversion.php
.../docs/Basic Components - Query - DQL - SQL conversion.php
+2
-0
Basic Components - Query - FROM - selecting tables.php
...cs/Basic Components - Query - FROM - selecting tables.php
+3
-2
Basic Components - Query - Introduction.php
manual/docs/Basic Components - Query - Introduction.php
+6
-5
documentation.php
manual/documentation.php
+322
-327
No files found.
manual/codes/Basic Components - Query - FROM - selecting tables.php
View file @
abb56d4f
...
@@ -18,7 +18,7 @@ $coll = $q->select('u.name, u.age, e.address')
...
@@ -18,7 +18,7 @@ $coll = $q->select('u.name, u.age, e.address')
// find all users, user email and user phonenumbers
// find all users, user email and user phonenumbers
$coll
=
$q
->
from
(
'FROM User u'
)
$coll
=
$q
->
from
(
'FROM User u'
)
->
left
Join
(
'u.Email e'
)
->
inner
Join
(
'u.Email e'
)
->
left
Join
(
'u.Phonenumber p'
)
->
inner
Join
(
'u.Phonenumber p'
)
->
execute
();
->
execute
();
?>
?>
manual/codes/Basic Components - Query - Introduction.php
View file @
abb56d4f
...
@@ -5,4 +5,8 @@ $q = new Doctrine_Query();
...
@@ -5,4 +5,8 @@ $q = new Doctrine_Query();
// initalizing a new Doctrine_Query (using custom connection parameter)
// initalizing a new Doctrine_Query (using custom connection parameter)
// here $conn is an instance of Doctrine_Connection
// here $conn is an instance of Doctrine_Connection
$q
=
new
Doctrine_Query
(
$conn
);
$q
=
new
Doctrine_Query
(
$conn
);
// an example using the create method
// here we simple fetch all users
$users
=
Doctrine_Query
::
create
()
->
from
(
'User'
)
->
execute
();
?>
?>
manual/codes/Basic Components - Query - ORDER BY - sorting query results.php
View file @
abb56d4f
<?php
<?php
$q
=
new
Doctrine_Query
();
// find all users, sort by name descending
// find all users, sort by name descending
$
coll
=
$conn
->
query
(
"FROM User ORDER BY User.name DESC"
);
$
users
=
$q
->
from
(
'User u'
)
->
orderby
(
'u.name DESC'
);
// find all users sort by name ascending
// find all users sort by name ascending
$coll
=
$conn
->
query
(
"FROM User ORDER BY User.name ASC"
);
$users
=
$q
->
from
(
'User u'
)
->
orderby
(
'u.name ASC'
);
// or
$coll
=
$conn
->
query
(
"FROM User ORDER BY User.name"
);
// find all users and their emails, sort by email address
// find all users and their emails, sort by email address
in ascending order
$
coll
=
$conn
->
query
(
"FROM User, User.Email ORDER BY User.Email.address"
);
$
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
// find all users and their emails, sort by user name and email address
$coll
=
$conn
->
query
(
"FROM User, User.Email ORDER BY User.name, User.Email.address"
);
$users
=
$q
->
from
(
'User u'
)
->
leftJoin
(
'u.Email e'
)
->
addOrderby
(
'u.name'
)
->
addOrderby
(
'e.address'
);
?>
?>
manual/docs/Basic Components - Query - DQL - SQL conversion.php
View file @
abb56d4f
<?php
<?php
/**
$str = "
$str = "
The following examples should give a hint of how DQL is converted into SQL.
The following examples should give a hint of how DQL is converted into SQL.
The classes used in here are the same as in chapter 14.1 (Users and groups are both entities etc).
The classes used in here are the same as in chapter 14.1 (Users and groups are both entities etc).
...
@@ -52,4 +53,5 @@ foreach($e as $line) {
...
@@ -52,4 +53,5 @@ foreach($e as $line) {
}
}
}
}
renderQueries($str);
renderQueries($str);
*/
?>
?>
manual/docs/Basic Components - Query - FROM - selecting tables.php
View file @
abb56d4f
...
@@ -3,7 +3,7 @@ The FROM clause indicates the component or components from which to retrieve rec
...
@@ -3,7 +3,7 @@ The FROM clause indicates the component or components from which to retrieve rec
If you name more than one component, you are performing a join.
If you name more than one component, you are performing a join.
For each table specified, you can optionally specify an alias. Doctrine_Query offers easy to use
For each table specified, you can optionally specify an alias. Doctrine_Query offers easy to use
methods such as from(), addFrom(), leftJoin() and innerJoin() for managing the FROM part of your DQL query.
methods such as from(), addFrom(), leftJoin() and innerJoin() for managing the FROM part of your DQL query.
<br
\
><br
\
>
<?php
<?php
renderCode
(
"<?php
renderCode
(
"<?php
// find all users
// find all users
...
@@ -15,4 +15,5 @@ renderCode("<?php
...
@@ -15,4 +15,5 @@ renderCode("<?php
\$
coll =
\$
q->select('u.name')->('User u');
\$
coll =
\$
q->select('u.name')->('User u');
?>"
);
?>"
);
?>
?>
<br
\
><br
\
>
The following example shows how to use leftJoin and innerJoin methods:
<br
\
><br
\
>
manual/docs/Basic Components - Query - Introduction.php
View file @
abb56d4f
<?php
?>
DQL (Doctrine Query Language) is a object query language which allows
DQL (Doctrine Query Language) is a object query language which allows
you to find objects. DQL understands things like object relationships, polymorphism and
you to find objects. DQL understands things like object relationships, polymorphism and
inheritance
(
including
column
aggregation
inheritance
)
.
inheritance (including column aggregation inheritance).
For more info about DQL see the actual DQL chapter.
<br
\
><br
\
>
<br
\
><br
\
>
So
instead
of
writing
lots
of
SQL
inner
and
outer
joins
,
unions
and
subselects
yourself
,
Doctrine_Query along with Doctrine_Expression provide an easy-to-use wrapper for writing DQL queries. Creating a new
you
can
write
simple
DQL
queries
where
relationships
are
being
referenced
with
dot
-
notation
.
query object can be done by either using the new operator or by calling create method. The create method exists for allowing easy
<
br
\
><
br
\
>
method call chaining.
You
can
execute
DQL
queries
with
Doctrine_Connection
::
query
()
method
.
manual/documentation.php
View file @
abb56d4f
This diff is collapsed.
Click to expand it.
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