Commit b90e3f9a authored by jeroendedauw's avatar jeroendedauw

Update docs to relfect the changes to QueryBuilder::from made in #646

parent d686e5d9
...@@ -36,9 +36,9 @@ input to any of the methods of the QueryBuilder and use the placeholder ...@@ -36,9 +36,9 @@ input to any of the methods of the QueryBuilder and use the placeholder
<?php <?php
$queryBuilder $queryBuilder
->select('u.id', 'u.name') ->select('id', 'name')
->from('users', 'u') ->from('users')
->where('u.email = ?') ->where('email = ?')
->setParameter(0, $userInputEmail) ->setParameter(0, $userInputEmail)
; ;
...@@ -62,8 +62,8 @@ For ``SELECT`` queries you start with invoking the ``select()`` method ...@@ -62,8 +62,8 @@ For ``SELECT`` queries you start with invoking the ``select()`` method
<?php <?php
$queryBuilder $queryBuilder
->select('u.id', 'u.name') ->select('id', 'name')
->from('users', 'u'); ->from('users');
For ``INSERT``, ``UPDATE`` and ``DELETE`` queries you can pass the For ``INSERT``, ``UPDATE`` and ``DELETE`` queries you can pass the
table name into the ``insert($tableName)``, ``update($tableName)`` table name into the ``insert($tableName)``, ``update($tableName)``
...@@ -74,15 +74,15 @@ and ``delete($tableName)``: ...@@ -74,15 +74,15 @@ and ``delete($tableName)``:
<?php <?php
$queryBuilder $queryBuilder
->insert('users', 'u') ->insert('users')
; ;
$queryBuilder $queryBuilder
->update('users', 'u') ->update('users')
; ;
$queryBuilder $queryBuilder
->delete('users', 'u') ->delete('users')
; ;
You can convert a query builder to its SQL string representation You can convert a query builder to its SQL string representation
...@@ -99,15 +99,31 @@ clauses with the following API: ...@@ -99,15 +99,31 @@ clauses with the following API:
<?php <?php
$queryBuilder $queryBuilder
->select('u.id', 'u.name') ->select('id', 'name')
->from('users', 'u') ->from('users')
->where('u.email = ?') ->where('email = ?')
; ;
Calling ``where()`` overwrites the previous clause and you can prevent Calling ``where()`` overwrites the previous clause and you can prevent
this by combining expressions with ``andWhere()`` and ``orWhere()`` methods. this by combining expressions with ``andWhere()`` and ``orWhere()`` methods.
You can alternatively use expressions to generate the where clause. 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 GROUP BY and HAVING Clause
~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment