Skip to content

Commit

Permalink
Add blank line before return statements in examples
Browse files Browse the repository at this point in the history
  • Loading branch information
ravage84 committed May 13, 2024
1 parent bab7d24 commit 96b2354
Show file tree
Hide file tree
Showing 58 changed files with 162 additions and 58 deletions.
1 change: 1 addition & 0 deletions en/controllers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,7 @@ You can redirect using :term:`routing array` values::
Or using a relative or absolute URL::

return $this->redirect('/orders/confirm');

return $this->redirect('http://www.example.com');

Or to the referer page::
Expand Down
3 changes: 3 additions & 0 deletions en/controllers/components/authentication.rst
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ an array of user information on the success or ``false`` on failure. ::
if (empty($username) || empty($pass)) {
return false;
}

return $this->_findUser($username, $pass);
}

Expand Down Expand Up @@ -382,6 +383,7 @@ generate these API tokens randomly using libraries from CakePHP::
// it during login.
$entity->api_key = $hasher->hash($entity->api_key_plain);
}

return true;
}
}
Expand Down Expand Up @@ -699,6 +701,7 @@ function accordingly::
$user->password = $this->request->getData('password');
$this->Users->save($user);
}

return $this->redirect($this->Auth->redirectUrl());
}
...
Expand Down
1 change: 1 addition & 0 deletions en/core-libraries/events.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ has been created. To keep your Orders model clean you could use events::

return true;
}

return false;
}
}
Expand Down
11 changes: 6 additions & 5 deletions en/core-libraries/validation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ conditions only::
if (isset($context['data']['action'])) {
return $context['data']['action'] === 'subscribe';
}

return false;
});
$validator->requirePresence('email');
Expand Down Expand Up @@ -565,10 +566,10 @@ following::
Validating Entity Data
======================

Validation is meant for checking request data coming from forms or other user
Validation is meant for checking request data coming from forms or other user
interfaces used to populate the entities.

The request data is validated automatically when using the ``newEntity()``,
The request data is validated automatically when using the ``newEntity()``,
``newEntities()``, ``patchEntity()`` or ``patchEntities()`` methods of ``Table`` class::

// In the ArticlesController class
Expand Down Expand Up @@ -601,9 +602,9 @@ validation sets to apply using the ``options`` parameter::
]
]);

Apart from validating user provided data maintaining integrity of data regardless
where it came from is important. To solve this problem CakePHP offers a second
level of validation which is called "application rules". You can read more about
Apart from validating user provided data maintaining integrity of data regardless
where it came from is important. To solve this problem CakePHP offers a second
level of validation which is called "application rules". You can read more about
them in the :ref:`Applying Application Rules <application-rules>` section.

Core Validation Rules
Expand Down
14 changes: 8 additions & 6 deletions en/development/routing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1102,17 +1102,17 @@ Would create read only resource routes. The route names are ``create``,
The default **route name and controller action used** are as follows:

=========== =======================
Route name Controller action used
Route name Controller action used
=========== =======================
create add
create add
----------- -----------------------
update edit
update edit
----------- -----------------------
view view
view view
----------- -----------------------
index index
index index
----------- -----------------------
delete delete
delete delete
=========== =======================


Expand Down Expand Up @@ -1679,6 +1679,7 @@ URL filters allow you to implement features like persistent parameters::
if ($request->getParam('lang') && !isset($params['lang'])) {
$params['lang'] = $request->getParam('lang');
}

return $params;
});

Expand All @@ -1697,6 +1698,7 @@ example)::
$params['language'] = $params[0];
unset($params[0]);
}

return $params;
});

Expand Down
1 change: 1 addition & 0 deletions en/development/sessions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ something like::
if ($result) {
return $result;
}

return parent::read($id);
}

Expand Down
1 change: 1 addition & 0 deletions en/development/testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1926,6 +1926,7 @@ Expanding on the Orders example, say we have the following tables::

return true;
}

return false;
}
}
Expand Down
5 changes: 5 additions & 0 deletions en/orm/database-basics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,7 @@ class::
if ($value === null) {
return null;
}

return json_decode($value, true);
}

Expand All @@ -499,6 +500,7 @@ class::
if (is_array($value) || $value === null) {
return $value;
}

return json_decode($value, true);
}

Expand All @@ -512,6 +514,7 @@ class::
if ($value === null) {
return PDO::PARAM_NULL;
}

return PDO::PARAM_STR;
}
}
Expand Down Expand Up @@ -586,6 +589,7 @@ used::
if (isset($data['null') && $data['null'] === false) {
$sql .= ' NOT NULL';
}

return $sql;
}

Expand Down Expand Up @@ -693,6 +697,7 @@ value object and into SQL expressions::
if (is_array($value)) {
return new Point($value[0], $value[1]);
}

return null;
}

Expand Down
1 change: 1 addition & 0 deletions en/orm/retrieving-data-and-resultsets.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1000,6 +1000,7 @@ extract a list of unique tags on a collection of articles by running::
if (!in_array($value, $output)) {
$output[] = $value;
}

return $output;
};

Expand Down
1 change: 1 addition & 0 deletions en/orm/validation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ You can also use closures for validation rules::
if ($value > 1) {
return true;
}

return 'Not a good value.';
}
]);
Expand Down
2 changes: 2 additions & 0 deletions en/tutorials-and-examples/blog/part-three.rst
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ the tree::
} else {
$this->Flash->error('The category could not be moved up. Please, try again.');
}

return $this->redirect($this->referer(['action' => 'index']));
}

Expand All @@ -278,6 +279,7 @@ the tree::
} else {
$this->Flash->error('The category could not be moved down. Please, try again.');
}

return $this->redirect($this->referer(['action' => 'index']));
}
}
Expand Down
1 change: 1 addition & 0 deletions en/tutorials-and-examples/bookmarks/intro.rst
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,7 @@ method has not been implemented yet, so let's do that. In
->where(['Tags.title IN ' => $options['tags']])
->group(['Bookmarks.id']);
}

return $query;
}

Expand Down
2 changes: 2 additions & 0 deletions en/tutorials-and-examples/bookmarks/part-two.rst
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ sense. First, we'll add the authorization logic for bookmarks. In your
if ($bookmark->user_id == $user['id']) {
return true;
}

return parent::isAuthorized($user);
}

Expand Down Expand Up @@ -396,6 +397,7 @@ to **src/Model/Table/BookmarksTable.php**::
foreach ($newTags as $tag) {
$out[] = $this->Tags->newEntity(['title' => $tag]);
}

return $out;
}

Expand Down
1 change: 1 addition & 0 deletions en/tutorials-and-examples/cms/tags-and-users.rst
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,7 @@ to **src/Model/Table/ArticlesTable.php**::
foreach ($newTags as $tag) {
$out[] = $this->Tags->newEntity(['title' => $tag]);
}

return $out;
}

Expand Down
Loading

0 comments on commit 96b2354

Please sign in to comment.