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
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')
// find all users, user email and user phonenumbers
$coll
=
$q
->
from
(
'FROM User u'
)
->
left
Join
(
'u.Email e'
)
->
left
Join
(
'u.Phonenumber p'
)
->
inner
Join
(
'u.Email e'
)
->
inner
Join
(
'u.Phonenumber p'
)
->
execute
();
?>
manual/codes/Basic Components - Query - Introduction.php
View file @
abb56d4f
...
...
@@ -5,4 +5,8 @@ $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
();
?>
manual/codes/Basic Components - Query - ORDER BY - sorting query results.php
View file @
abb56d4f
<?php
$q
=
new
Doctrine_Query
();
// 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
$coll
=
$conn
->
query
(
"FROM User ORDER BY User.name ASC"
);
// or
$coll
=
$conn
->
query
(
"FROM User ORDER BY User.name"
);
$users
=
$q
->
from
(
'User u'
)
->
orderby
(
'u.name ASC'
);
// 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
$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
/**
$str = "
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).
...
...
@@ -52,4 +53,5 @@ foreach($e as $line) {
}
}
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
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
methods such as from(), addFrom(), leftJoin() and innerJoin() for managing the FROM part of your DQL query.
<br
\
><br
\
>
<?php
renderCode
(
"<?php
// find all users
...
...
@@ -15,4 +15,5 @@ renderCode("<?php
\$
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
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
\
>
So
instead
of
writing
lots
of
SQL
inner
and
outer
joins
,
unions
and
subselects
yourself
,
you
can
write
simple
DQL
queries
where
relationships
are
being
referenced
with
dot
-
notation
.
<
br
\
><
br
\
>
You
can
execute
DQL
queries
with
Doctrine_Connection
::
query
()
method
.
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.
manual/documentation.php
View file @
abb56d4f
...
...
@@ -92,261 +92,256 @@ function array2path($array, $path = '') {
return
$arrayValues
;
}
$menu
=
array
(
"Getting started"
=>
$menu
=
array
(
'Getting started'
=>
array
(
"Requirements"
,
"Installation"
,
"Compiling"
,
"Starting new project"
,
"Setting table definition"
=>
array
(
"Introduction"
,
"Table and class naming"
,
"Field(Column) naming"
,
"Data types and lengths"
,
"Constraints and validators"
,
"Default values"
,
"Enum emulation"
,
'Requirements'
,
'Installation'
,
'Compiling'
,
'Starting new project'
,
'Setting table definition'
=>
array
(
'Introduction'
,
'Table and class naming'
,
'Field(Column) naming'
,
'Data types and lengths'
,
'Constraints and validators'
,
'Default values'
,
'Enum emulation'
,
),
"Record identifiers"
=>
array
(
"Introduction"
,
"Autoincremented"
,
"Natural"
,
"Composite"
,
"Sequential"
)
'Record identifiers'
=>
array
(
'Introduction'
,
'Autoincremented'
,
'Natural'
,
'Composite'
,
'Sequential'
)
),
"Connection management"
=>
'Connection management'
=>
array
(
"Opening a new connection"
,
"Lazy-connecting to database"
,
"Managing connections"
,
"Connection-component binding"
'Opening a new connection'
,
'Lazy-connecting to database'
,
'Managing connections'
,
'Connection-component binding'
),
"Schema reference"
=>
'Schema reference'
=>
array
(
"Data types"
=>
array
(
"Introduction"
,
"Type modifiers"
,
"Boolean"
,
"Integer"
,
"Float"
,
"String"
,
"Array"
,
"Object"
,
"Blob"
,
"Clob"
,
"Timestamp"
,
"Time"
,
"Date"
,
"Enum"
,
"Gzip"
,
'Data types'
=>
array
(
'Introduction'
,
'Type modifiers'
,
'Boolean'
,
'Integer'
,
'Float'
,
'String'
,
'Array'
,
'Object'
,
'Blob'
,
'Clob'
,
'Timestamp'
,
'Time'
,
'Date'
,
'Enum'
,
'Gzip'
,
),
"Column attributes"
=>
array
(
"Introduction"
,
"Primary"
,
"Autoincrement"
,
"Default"
,
"Zerofill"
,
"Collation"
,
"Charset"
,
"Unsigned"
,
"Fixed"
,
"Enum"
,
"Unique"
,
"Nospace"
,
"Notblank"
,
"Notnull"
,
"Email"
,
"Date"
,
"Range"
,
"Numeric"
,
"Regexp"
,
"Ip"
,
"Usstate"
,
'Column attributes'
=>
array
(
'Introduction'
,
'Primary'
,
'Autoincrement'
,
'Default'
,
'Zerofill'
,
'Collation'
,
'Charset'
,
'Unsigned'
,
'Fixed'
,
'Enum'
,
'Unique'
,
'Nospace'
,
'Notblank'
,
'Notnull'
,
'Email'
,
'Date'
,
'Range'
,
'Numeric'
,
'Regexp'
,
'Ip'
,
'Usstate'
,
),
"Identifiers"
=>
array
(
"Introduction"
,
"Autoincremented"
,
"Natural"
,
"Composite"
,
"Sequential"
)
'Identifiers'
=>
array
(
'Introduction'
,
'Autoincremented'
,
'Natural'
,
'Composite'
,
'Sequential'
)
),
"Basic Components"
=>
'Basic Components'
=>
array
(
"Manager"
=>
array
(
"Introduction"
,
"Opening a new connection"
,
"Managing connections"
),
"Record"
=>
array
(
"Introduction"
,
"Creating new records"
,
"Retrieving existing records"
,
"Accessing properties"
,
"Updating records"
,
"Deleting records"
,
"Getting record state"
,
"Getting object copy"
,
"Serializing"
,
"Checking Existence"
,
"Callbacks"
),
"Connection"
=>
array
(
"Introduction"
,
"Available drivers"
,
"Getting a table object"
,
"Flushing the connection"
,
"Querying the database"
,
"Getting connection state"
),
"Collection"
=>
array
(
"Introduction"
,
"Accessing elements"
,
"Adding new elements"
,
"Getting collection count"
,
"Saving the collection"
,
"Deleting collection"
,
//
"Fetching strategies"
,
"Key mapping"
,
"Loading related records"
,
"Collection expanding"
,
'Manager'
=>
array
(
'Introduction'
,
'Opening a new connection'
,
'Managing connections'
),
'Record'
=>
array
(
'Introduction'
,
'Creating new records'
,
'Retrieving existing records'
,
'Accessing properties'
,
'Updating records'
,
'Deleting records'
,
'Getting record state'
,
'Getting object copy'
,
'Serializing'
,
'Checking Existence'
,
'Callbacks'
),
'Connection'
=>
array
(
'Introduction'
,
'Available drivers'
,
'Getting a table object'
,
'Flushing the connection'
,
'Querying the database'
,
'Getting connection state'
),
'Collection'
=>
array
(
'Introduction'
,
'Accessing elements'
,
'Adding new elements'
,
'Getting collection count'
,
'Saving the collection'
,
'Deleting collection'
,
//
'Fetching strategies'
,
'Key mapping'
,
'Loading related records'
,
'Collection expanding'
,
),
"Table"
=>
array
(
"Introduction"
,
"Getting table information"
,
"Finder methods"
,
"Custom table classes"
,
"Custom finders"
,
"Getting relation objects"
),
"Query"
=>
array
(
"Introduction"
,
"FROM - selecting tables"
,
"LIMIT and OFFSET - limiting the query results"
,
"WHERE - setting query conditions"
,
"ORDER BY - sorting query results"
,
//"Fetching strategies",
//"Lazy property fetching",
"Method overloading"
,
"Relation operators"
,
"Bound parameters"
,
"Aggregate functions"
,
"DQL - SQL conversion"
),
"RawSql"
=>
array
(
"Introduction"
,
"Using SQL"
,
"Adding components"
,
"Method overloading"
),
"Db"
=>
array
(
"Introduction"
,
"Connecting to a database"
,
"Using event listeners"
,
"Chaining listeners"
),
'Table'
=>
array
(
'Introduction'
,
'Getting table information'
,
'Finder methods'
,
'Custom table classes'
,
'Custom finders'
,
'Getting relation objects'
),
'Query'
=>
array
(
'Introduction'
,
'FROM - selecting tables'
,
'LIMIT and OFFSET - limiting the query results'
,
'WHERE - setting query conditions'
,
'HAVING conditions'
,
'ORDER BY - sorting query results'
,
),
'RawSql'
=>
array
(
'Introduction'
,
'Using SQL'
,
'Adding components'
,
'Method overloading'
),
'Db'
=>
array
(
'Introduction'
,
'Connecting to a database'
,
'Using event listeners'
,
'Chaining listeners'
),
/**
"Statement - <font color='red'>UNDER CONSTRUCTION</font>" => array("Introduction"
,
"Setting parameters"
,
"Getting parameters"
,
"Getting row count"
,
"Executing the statement"
),
'Statement - <font color='red'>UNDER CONSTRUCTION</font>' => array('Introduction'
,
'Setting parameters'
,
'Getting parameters'
,
'Getting row count'
,
'Executing the statement'
),
*/
"Exceptions"
=>
array
(
"Overview"
,
"List of exceptions"
'Exceptions'
=>
array
(
'Overview'
,
'List of exceptions'
)
),
"Mapping object relations"
=>
'Mapping object relations'
=>
array
(
"Introduction"
,
"Composites and aggregates"
,
"Relation aliases"
,
"Foreign key associations"
=>
array
(
"One-to-One"
,
"One-to-Many, Many-to-One"
,
"Tree structure"
),
"Join table associations"
=>
array
(
"One-to-One"
,
"One-to-Many, Many-to-One"
,
"Many-to-Many"
,
"Self-referencing"
),
"Dealing with relations"
=>
array
(
"Creating related records"
,
"Retrieving related records"
,
"Updating related records"
,
"Deleting related records"
,
"Working with associations"
),
"Inheritance"
=>
array
(
"One table many classes"
,
"One table one class"
,
"Column aggregation"
'Introduction'
,
'Composites and aggregates'
,
'Relation aliases'
,
'Foreign key associations'
=>
array
(
'One-to-One'
,
'One-to-Many, Many-to-One'
,
'Tree structure'
),
'Join table associations'
=>
array
(
'One-to-One'
,
'One-to-Many, Many-to-One'
,
'Many-to-Many'
,
'Self-referencing'
),
'Dealing with relations'
=>
array
(
'Creating related records'
,
'Retrieving related records'
,
'Updating related records'
,
'Deleting related records'
,
'Working with associations'
),
'Inheritance'
=>
array
(
'One table many classes'
,
'One table one class'
,
'Column aggregation'
),
),
"Configuration"
=>
'Configuration'
=>
array
(
"Introduction"
,
"Levels of configuration"
,
"Setting attributes"
=>
array
(
"Portability"
,
"Identifier quoting"
,
"Table creation"
,
"Fetching strategy"
,
"Batch size"
,
"Session lockmode"
,
"Event listener"
,
"Validation"
,
"Offset collection limit"
'Introduction'
,
'Levels of configuration'
,
'Setting attributes'
=>
array
(
'Portability'
,
'Identifier quoting'
,
'Table creation'
,
'Fetching strategy'
,
'Batch size'
,
'Session lockmode'
,
'Event listener'
,
'Validation'
,
'Offset collection limit'
)
),
"Advanced components"
=>
array
(
"Eventlisteners"
=>
'Advanced components'
=>
array
(
'Eventlisteners'
=>
array
(
"Introduction"
,
"Creating new listener"
,
"List of events"
,
"Listening events"
,
"Chaining"
,
"AccessorInvoker"
,
"Creating a logger"
,
'Introduction'
,
'Creating new listener'
,
'List of events'
,
'Listening events'
,
'Chaining'
,
'AccessorInvoker'
,
'Creating a logger'
,
),
"Validators"
=>
array
(
"Introduction"
,
"More Validation"
,
"Valid or Not Valid"
,
"List of predefined validators"
'Validators'
=>
array
(
'Introduction'
,
'More Validation'
,
'Valid or Not Valid'
,
'List of predefined validators'
),
"View"
=>
array
(
"Intoduction"
,
"Managing views"
,
"Using views"
'View'
=>
array
(
'Intoduction'
,
'Managing views'
,
'Using views'
),
"Cache"
=>
array
(
"Introduction"
,
"Query cache"
),
"Locking Manager"
=>
array
(
"Introduction"
,
"Examples"
,
"Planned"
,
"Technical Details"
,
"Maintainer"
),
'Cache'
=>
array
(
'Introduction'
,
'Query cache'
),
'Locking Manager'
=>
array
(
'Introduction'
,
'Examples'
,
'Planned'
,
'Technical Details'
,
'Maintainer'
),
/**
"Debugger"
=> array(
"Introduction"
,
"Debugging actions"
),
"Library"
=> array(
"Introduction"
,
"Using library functions"
),
"Iterator"
=> array(
"Introduction"
,
"BatchIterator"
,
"ExpandableIterator"
,
"OffsetIterator"
)
'Debugger'
=> array(
'Introduction'
,
'Debugging actions'
),
'Library'
=> array(
'Introduction'
,
'Using library functions'
),
'Iterator'
=> array(
'Introduction'
,
'BatchIterator'
,
'ExpandableIterator'
,
'OffsetIterator'
)
*/
),
"DQL (Doctrine Query Language)"
=>
'DQL (Doctrine Query Language)'
=>
array
(
'Introduction'
,
...
...
@@ -386,154 +381,154 @@ $menu = array("Getting started" =>
'Examples'
,
'BNF'
),
"Transactions"
=>
array
(
"Introduction"
,
"Unit of work"
,
"Nesting"
,
"Savepoints"
,
"Locking strategies"
=>
array
(
"Pessimistic locking"
,
"Optimistic locking"
),
'Transactions'
=>
array
(
'Introduction'
,
'Unit of work'
,
'Nesting'
,
'Savepoints'
,
'Locking strategies'
=>
array
(
'Pessimistic locking'
,
'Optimistic locking'
),
"Lock modes"
,
"Isolation levels"
,
"Deadlocks"
,
'Lock modes'
,
'Isolation levels'
,
'Deadlocks'
,
),
"Native SQL"
=>
array
(
"Scalar queries"
,
"Component queries"
,
"Fetching multiple components"
,
'Native SQL'
=>
array
(
'Scalar queries'
,
'Component queries'
,
'Fetching multiple components'
,
),
/**
"Developer components"
=> array(
"DataDict"
=> array(
"Introduction"
,
"Usage"
'Developer components'
=> array(
'DataDict'
=> array(
'Introduction'
,
'Usage'
),
"IndexGenerator"
=>
'IndexGenerator'
=>
array(
"Introduction"
,
"Usage"
),
"Relation"
=> array(
"Introduction"
,
"Types of relations"
,
'Introduction'
,
'Usage'
),
'Relation'
=> array(
'Introduction'
,
'Types of relations'
,
),
"Null"
=> array(
"Introduction"
,
"Extremely fast null value checking"
'Null'
=> array(
'Introduction'
,
'Extremely fast null value checking'
),
"Access"
=> array(
"Introduction"
,
"Usage"
'Access'
=> array(
'Introduction'
,
'Usage'
),
"Configurable"
=> array(
"Introduction"
,
"Usage"
'Configurable'
=> array(
'Introduction'
,
'Usage'
),
),
*/
/**
"Improving performance"
=> array(
"Introduction"
,
"Data types"
=>
'Improving performance'
=> array(
'Introduction'
,
'Data types'
=>
array(
"Enum"
,
'Enum'
,
),
"Primary keys"
=> array(
"When to use surrogate primary keys"
,
'Primary keys'
=> array(
'When to use surrogate primary keys'
,
),
"Constraints"
=> array(
"General tips"
,
"Foreign keys"
,
"Triggers"
,
'Constraints'
=> array(
'General tips'
,
'Foreign keys'
,
'Triggers'
,
),
"Data manipulation"
=> array(
"INSERT queries"
,
"UPDATE queries"
,
"DELETE queries"
,
'Data manipulation'
=> array(
'INSERT queries'
,
'UPDATE queries'
,
'DELETE queries'
,
),
"Indexes"
=> array(
"General tips"
,
"Using compound indexes"
,
'Indexes'
=> array(
'General tips'
,
'Using compound indexes'
,
),
"Transactions"
=> array(
"General tips"
,
"Locks"
,
"Isolation"
,
'Transactions'
=> array(
'General tips'
,
'Locks'
,
'Isolation'
,
),
"Data fetching"
=> array(
"General tips"
,
'Data fetching'
=> array(
'General tips'
,
),
"Normalization"
=> array(
'Normalization'
=> array(
),
"Caching"
=> array(
"General tips"
'Caching'
=> array(
'General tips'
),
"Performance monitoring" => array( "Using the database profiler"
)
'Performance monitoring' => array( 'Using the database profiler'
)
),
*/
"Connection modules"
=>
array
(
"Export"
=>
array
(
"Introduction"
,
"Creating new table"
,
"Altering table"
'Connection modules'
=>
array
(
'Export'
=>
array
(
'Introduction'
,
'Creating new table'
,
'Altering table'
),
"Import"
=>
array
(
"Introduction"
,
"Getting table info"
,
"Getting foreign key info"
,
"Getting view info"
,
'Import'
=>
array
(
'Introduction'
,
'Getting table info'
,
'Getting foreign key info'
,
'Getting view info'
,
),
"Util"
=>
array
(
"Using explain"
),
"DataDict"
=>
array
(
"Getting portable type"
,
"Getting database declaration"
,
"Reserved keywords"
),
'Util'
=>
array
(
'Using explain'
),
'DataDict'
=>
array
(
'Getting portable type'
,
'Getting database declaration'
,
'Reserved keywords'
),
),
"Technology"
=>
array
(
"Architecture"
,
"Design patterns used"
,
"Speed"
,
"Internal optimizations"
=>
array
(
"DELETE"
,
"INSERT"
,
"UPDATE"
),
'Technology'
=>
array
(
'Architecture'
,
'Design patterns used'
,
'Speed'
,
'Internal optimizations'
=>
array
(
'DELETE'
,
'INSERT'
,
'UPDATE'
),
),
"Real world examples"
=>
array
(
"User management system"
,
"Forum application"
,
"Album lister"
),
'Real world examples'
=>
array
(
'User management system'
,
'Forum application'
,
'Album lister'
),
"Coding standards"
=>
array
(
"Overview"
=>
'Coding standards'
=>
array
(
'Overview'
=>
array
(
"Scope"
,
"Goals"
'Scope'
,
'Goals'
),
"PHP File Formatting"
=>
array
(
"General"
,
"Indentation"
,
"Maximum line length"
,
"Line termination"
'PHP File Formatting'
=>
array
(
'General'
,
'Indentation'
,
'Maximum line length'
,
'Line termination'
),
"Naming Conventions"
=>
array
(
"Classes"
,
"Interfaces"
,
"Filenames"
,
"Functions and methods"
,
"Variables"
,
"Constants"
,
"Record columns"
,
'Naming Conventions'
=>
array
(
'Classes'
,
'Interfaces'
,
'Filenames'
,
'Functions and methods'
,
'Variables'
,
'Constants'
,
'Record columns'
,
),
"Coding Style"
=>
array
(
"PHP code demarcation"
,
"Strings"
,
"Arrays"
,
"Classes"
,
"Functions and methods"
,
"Control statements"
,
"Inline documentation"
'Coding Style'
=>
array
(
'PHP code demarcation'
,
'Strings'
,
'Arrays'
,
'Classes'
,
'Functions and methods'
,
'Control statements'
,
'Inline documentation'
),
)
);
...
...
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