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
b90e3f9a
Commit
b90e3f9a
authored
Aug 01, 2014
by
jeroendedauw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update docs to relfect the changes to QueryBuilder::from made in #646
parent
d686e5d9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
11 deletions
+27
-11
query-builder.rst
docs/en/reference/query-builder.rst
+27
-11
No files found.
docs/en/reference/query-builder.rst
View file @
b90e3f9a
...
...
@@ -36,9 +36,9 @@ input to any of the methods of the QueryBuilder and use the placeholder
<?php
$queryBuilder
->select('
u.id', 'u.
name')
->from('users'
, 'u'
)
->where('
u.
email = ?')
->select('
id', '
name')
->from('users')
->where('email = ?')
->setParameter(0, $userInputEmail)
;
...
...
@@ -62,8 +62,8 @@ For ``SELECT`` queries you start with invoking the ``select()`` method
<?php
$queryBuilder
->select('
u.id', 'u.
name')
->from('users'
, 'u'
);
->select('
id', '
name')
->from('users');
For ``INSERT``, ``UPDATE`` and ``DELETE`` queries you can pass the
table name into the ``insert($tableName)``, ``update($tableName)``
...
...
@@ -74,15 +74,15 @@ and ``delete($tableName)``:
<?php
$queryBuilder
->insert('users'
, 'u'
)
->insert('users')
;
$queryBuilder
->update('users'
, 'u'
)
->update('users')
;
$queryBuilder
->delete('users'
, 'u'
)
->delete('users')
;
You can convert a query builder to its SQL string representation
...
...
@@ -99,15 +99,31 @@ clauses with the following API:
<?php
$queryBuilder
->select('
u.id', 'u.
name')
->from('users'
, 'u'
)
->where('
u.
email = ?')
->select('
id', '
name')
->from('users')
->where('email = ?')
;
Calling ``where()`` overwrites the previous clause and you can prevent
this by combining expressions with ``andWhere()`` and ``orWhere()`` methods.
You can alternatively use expressions to generate the where clause.
Table alias
~~~~~~~~~~~
The ``from()`` method takes an optional second parameter with which a table
alias can be specified.
.. code-block:: php
<?php
$queryBuilder
->select('u.id', 'u.name')
->from('users', 'u')
->where('u.email = ?')
;
GROUP BY and HAVING Clause
~~~~~~~~~~~~~~~~~~~~~~~~~~
...
...
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