Skip to content

Commit

Permalink
Fix up formatting in code snippets in API docs.
Browse files Browse the repository at this point in the history
The new version of ApiGen does not like leading spaces inside code
blocks.
  • Loading branch information
markstory committed Jul 10, 2016
1 parent c318328 commit 3f89bfb
Show file tree
Hide file tree
Showing 2 changed files with 147 additions and 147 deletions.
134 changes: 67 additions & 67 deletions src/Database/Query.php
Expand Up @@ -236,11 +236,11 @@ public function sql(ValueBinder $generator = null)
*
* ### Example:
* ```
* $query->select(['title'])->from('articles')->traverse(function ($value, $clause) {
* if ($clause === 'select') {
* var_dump($value);
* }
* }, ['select', 'from']);
* $query->select(['title'])->from('articles')->traverse(function ($value, $clause) {
* if ($clause === 'select') {
* var_dump($value);
* }
* }, ['select', 'from']);
* ```
*
* @param callable $visitor A function or callable to be executed for each part
Expand Down Expand Up @@ -410,10 +410,10 @@ public function modifier($modifiers, $overwrite = false)
* ### Examples:
*
* ```
* $query->from(['p' => 'posts']); // Produces FROM posts p
* $query->from('authors'); // Appends authors: FROM posts p, authors
* $query->from(['products'], true); // Resets the list: FROM products
* $query->from(['sub' => $countQuery]); // FROM (SELECT ...) sub
* $query->from(['p' => 'posts']); // Produces FROM posts p
* $query->from('authors'); // Appends authors: FROM posts p, authors
* $query->from(['products'], true); // Resets the list: FROM products
* $query->from(['sub' => $countQuery]); // FROM (SELECT ...) sub
* ```
*
* @param array|\Cake\Database\ExpressionInterface|string $tables tables to be added to the list
Expand Down Expand Up @@ -457,33 +457,33 @@ public function from($tables = [], $overwrite = false)
* A join can be fully described and aliased using the array notation:
*
* ```
* $query->join([
* 'a' => [
* 'table' => 'authors',
* 'type' => 'LEFT',
* 'conditions' => 'a.id = b.author_id'
* ]
* ]);
* // Produces LEFT JOIN authors a ON a.id = b.author_id
* $query->join([
* 'a' => [
* 'table' => 'authors',
* 'type' => 'LEFT',
* 'conditions' => 'a.id = b.author_id'
* ]
* ]);
* // Produces LEFT JOIN authors a ON a.id = b.author_id
* ```
*
* You can even specify multiple joins in an array, including the full description:
*
* ```
* $query->join([
* 'a' => [
* 'table' => 'authors',
* 'type' => 'LEFT',
* 'conditions' => 'a.id = b.author_id'
* ],
* 'p' => [
* 'table' => 'publishers',
* 'type' => 'INNER',
* 'conditions' => 'p.id = b.publisher_id AND p.name = "Cake Software Foundation"'
* ]
* ]);
* // LEFT JOIN authors a ON a.id = b.author_id
* // INNER JOIN publishers p ON p.id = b.publisher_id AND p.name = "Cake Software Foundation"
* $query->join([
* 'a' => [
* 'table' => 'authors',
* 'type' => 'LEFT',
* 'conditions' => 'a.id = b.author_id'
* ],
* 'p' => [
* 'table' => 'publishers',
* 'type' => 'INNER',
* 'conditions' => 'p.id = b.publisher_id AND p.name = "Cake Software Foundation"'
* ]
* ]);
* // LEFT JOIN authors a ON a.id = b.author_id
* // INNER JOIN publishers p ON p.id = b.publisher_id AND p.name = "Cake Software Foundation"
* ```
*
* ### Using conditions and types
Expand All @@ -497,14 +497,14 @@ public function from($tables = [], $overwrite = false)
* using the second parameter of this function.
*
* ```
* $query->join(['a' => [
* 'table' => 'articles',
* 'conditions' => [
* 'a.posted >=' => new DateTime('-3 days'),
* 'a.published' => true,
* 'a.author_id = authors.id'
* ]
* ]], ['a.posted' => 'datetime', 'a.published' => 'boolean'])
* $query->join(['a' => [
* 'table' => 'articles',
* 'conditions' => [
* 'a.posted >=' => new DateTime('-3 days'),
* 'a.published' => true,
* 'a.author_id = authors.id'
* ]
* ]], ['a.posted' => 'datetime', 'a.published' => 'boolean'])
* ```
*
* ### Overwriting joins
Expand All @@ -515,9 +515,9 @@ public function from($tables = [], $overwrite = false)
* with another list if the third parameter for this function is set to true.
*
* ```
* $query->join(['alias' => 'table']); // joins table with as alias
* $query->join(['alias' => 'another_table']); // joins another_table with as alias
* $query->join(['something' => 'different_table'], [], true); // resets joins list
* $query->join(['alias' => 'table']); // joins table with as alias
* $query->join(['alias' => 'another_table']); // joins another_table with as alias
* $query->join(['something' => 'different_table'], [], true); // resets joins list
* ```
*
* @param array|string|null $tables list of tables to be joined in the query
Expand Down Expand Up @@ -707,11 +707,11 @@ protected function _makeJoin($table, $conditions, $type)
* ### Conditions using operators:
*
* ```
* $query->where([
* 'posted >=' => new DateTime('3 days ago'),
* 'title LIKE' => 'Hello W%',
* 'author_id' => 1,
* ], ['posted' => 'datetime']);
* $query->where([
* 'posted >=' => new DateTime('3 days ago'),
* 'title LIKE' => 'Hello W%',
* 'author_id' => 1,
* ], ['posted' => 'datetime']);
* ```
*
* The previous example produces:
Expand All @@ -724,11 +724,11 @@ protected function _makeJoin($table, $conditions, $type)
* ### Nesting conditions with conjunctions:
*
* ```
* $query->where([
* 'author_id !=' => 1,
* 'OR' => ['published' => true, 'posted <' => new DateTime('now')],
* 'NOT' => ['title' => 'Hello']
* ], ['published' => boolean, 'posted' => 'datetime']
* $query->where([
* 'author_id !=' => 1,
* 'OR' => ['published' => true, 'posted <' => new DateTime('now')],
* 'NOT' => ['title' => 'Hello']
* ], ['published' => boolean, 'posted' => 'datetime']
* ```
*
* The previous example produces:
Expand All @@ -749,8 +749,8 @@ protected function _makeJoin($table, $conditions, $type)
* ### Using expressions objects:
*
* ```
* $exp = $query->newExpr()->add(['id !=' => 100, 'author_id' != 1])->tieWith('OR');
* $query->where(['published' => true], ['published' => 'boolean'])->where($exp);
* $exp = $query->newExpr()->add(['id !=' => 100, 'author_id' != 1])->tieWith('OR');
* $query->where(['published' => true], ['published' => 'boolean'])->where($exp);
* ```
*
* The previous example produces:
Expand All @@ -767,13 +767,13 @@ protected function _makeJoin($table, $conditions, $type)
* added the list of conditions for the query using the AND operator.
*
* ```
* $query
* ->where(['title !=' => 'Hello World'])
* ->where(function ($exp, $query) {
* $or = $exp->or_(['id' => 1]);
* $and = $exp->and_(['id >' => 2, 'id <' => 10]);
* return $or->add($and);
* });
* $query
* ->where(['title !=' => 'Hello World'])
* ->where(function ($exp, $query) {
* $or = $exp->or_(['id' => 1]);
* $and = $exp->and_(['id >' => 2, 'id <' => 10]);
* return $or->add($and);
* });
* ```
*
* * The previous example produces:
Expand All @@ -783,7 +783,7 @@ protected function _makeJoin($table, $conditions, $type)
* ### Conditions as strings:
*
* ```
* $query->where(['articles.author_id = authors.id', 'modified IS NULL']);
* $query->where(['articles.author_id = authors.id', 'modified IS NULL']);
* ```
*
* The previous example produces:
Expand Down Expand Up @@ -1213,8 +1213,8 @@ public function limit($num)
* ### Examples
*
* ```
* $query->offset(10) // generates OFFSET 10
* $query->offset($query->newExpr()->add(['1 + 1'])); // OFFSET (1 + 1)
* $query->offset(10) // generates OFFSET 10
* $query->offset($query->newExpr()->add(['1 + 1'])); // OFFSET (1 + 1)
* ```
*
* @param int|\Cake\Database\ExpressionInterface $num number of records to be skipped
Expand Down Expand Up @@ -1242,8 +1242,8 @@ public function offset($num)
* ### Examples
*
* ```
* $union = (new Query($conn))->select(['id', 'title'])->from(['a' => 'articles']);
* $query->select(['id', 'name'])->from(['d' => 'things'])->union($union);
* $union = (new Query($conn))->select(['id', 'title'])->from(['a' => 'articles']);
* $query->select(['id', 'name'])->from(['d' => 'things'])->union($union);
* ```
*
* Will produce:
Expand Down Expand Up @@ -1414,7 +1414,7 @@ public function update($table)
*
* ```
* $query->update('articles')->set(function ($exp) {
* return $exp->eq('title', 'The title', 'string');
* return $exp->eq('title', 'The title', 'string');
* });
* ```
*
Expand Down

0 comments on commit 3f89bfb

Please sign in to comment.