Skip to content

Commit

Permalink
[all lang] follows cakephp#4391
Browse files Browse the repository at this point in the history
  • Loading branch information
cake17 committed Oct 16, 2016
1 parent 4ed249e commit 70a63c8
Show file tree
Hide file tree
Showing 52 changed files with 222 additions and 190 deletions.
12 changes: 6 additions & 6 deletions en/controllers/request-response.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@ reference. Some of the duties ``Request`` performs include:
* Processing the GET, POST, and FILES arrays into the data structures you are
familiar with.
* Providing environment introspection pertaining to the request. Information
like the
headers sent, the client's IP address, and the subdomain/domain names the
server your application is running on.
like the headers sent, the client's IP address, and the subdomain/domain
names the server your application is running on.
* Providing access to request parameters both as array indexes and object
properties.

Expand Down Expand Up @@ -337,8 +336,9 @@ Restricting Which HTTP method an Action Accepts

.. php:method:: allowMethod($methods)
Set allowed HTTP methods. If not matched, will throw ``MethodNotAllowedException``
The 405 response will include the required ``Allow`` header with the passed methods::
Set allowed HTTP methods. If not matched, will throw
``MethodNotAllowedException``. The 405 response will include the required
``Allow`` header with the passed methods::

public function delete()
{
Expand All @@ -365,7 +365,7 @@ for the request. For example::
// Prior to 3.4.0
$this->request->header('User-Agent');

While some apache installs don't make the ``Authorization`` header accesisble,
While some apache installs don't make the ``Authorization`` header accessible,
CakePHP will make it available through apache specific methods as required.

.. php:method:: referer($local = false)
Expand Down
2 changes: 1 addition & 1 deletion en/tutorials-and-examples/bookmarks/part-two.rst
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ sense. First, we'll add the authorization logic for bookmarks. In your
return true;
}
// All other actions require an id.
if (!$this->request->params('pass.0')) {
if (!$this->request->param('pass.0')) {
return false;
}

Expand Down
10 changes: 5 additions & 5 deletions es/tutorials-and-examples/blog-auth-example/auth.rst
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ También vamos a crear UsersController; el siguiente contenido fue generado usan
{
$user = $this->Users->newEntity();
if ($this->request->is('post')) {
$user = $this->Users->patchEntity($user, $this->request->data);
$user = $this->Users->patchEntity($user, $this->request->data());
if ($this->Users->save($user)) {
$this->Flash->success(__('The user has been saved.'));
return $this->redirect(['action' => 'add']);
Expand Down Expand Up @@ -259,7 +259,7 @@ También, un pequeño cambio en ArticlesController es necesario para guardar el
{
$article = $this->Articles->newEntity();
if ($this->request->is('post')) {
$article = $this->Articles->patchEntity($article, $this->request->data);
$article = $this->Articles->patchEntity($article, $this->request->data());
// Added this line
$article->user_id = $this->Auth->user('id');
// You could also do the following
Expand Down Expand Up @@ -317,13 +317,13 @@ Esto no es exactamente lo que queriamos, por lo que tendremos que agregar mas re
public function isAuthorized($user)
{
// All registered users can add articles
if ($this->request->action === 'add') {
if ($this->request->param('action') === 'add') {
return true;
}

// The owner of an article can edit and delete it
if (in_array($this->request->action, ['edit', 'delete'])) {
$articleId = (int)$this->request->params['pass'][0];
if (in_array($this->request->param('action'), ['edit', 'delete'])) {
$articleId = (int)$this->request->param('pass.0');
if ($this->Articles->isOwnedBy($articleId, $user['id'])) {
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion es/tutorials-and-examples/blog/part-three.rst
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ Esto nos permitirá elegir una categoría para un Article al momento de crearlo
{
$article = $this->Articles->newEntity();
if ($this->request->is('post')) {
$article = $this->Articles->patchEntity($article, $this->request->data);
$article = $this->Articles->patchEntity($article, $this->request->data());
if ($this->Articles->save($article)) {
$this->Flash->success(__('Your article has been saved.'));
return $this->redirect(['action' => 'index']);
Expand Down
6 changes: 3 additions & 3 deletions es/tutorials-and-examples/blog/part-two.rst
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ ArticlesController::
{
$article = $this->Articles->newEntity();
if ($this->request->is('post')) {
$article = $this->Articles->patchEntity($article, $this->request->data);
$article = $this->Articles->patchEntity($article, $this->request->data());
if ($this->Articles->save($article)) {
$this->Flash->success(__('Your article has been saved.'));
return $this->redirect(['action' => 'index']);
Expand Down Expand Up @@ -298,7 +298,7 @@ de nuestra aplicación. En este caso, utilizamos el método
petición HTTP POST.

Cuando un usuario utiliza un formulario y efectúa un POST a la aplicación, esta
información está disponible en ``$this->request->data``. Puedes usar la función
información está disponible en ``$this->request->data()``. Puedes usar la función
:php:func:`pr()` o :php:func:`debug()` para mostrar el contenido de esa variable
y ver la pinta que tiene.

Expand Down Expand Up @@ -424,7 +424,7 @@ ser la acción ``edit()`` del controlador ``ArticlesController``::
{
$article = $this->Articles->get($id);
if ($this->request->is(['post', 'put'])) {
$this->Articles->patchEntity($article, $this->request->data);
$this->Articles->patchEntity($article, $this->request->data());
if ($this->Articles->save($article)) {
$this->Flash->success(__('Tu artículo ha sido actualizado.'));
return $this->redirect(['action' => 'index']);
Expand Down
6 changes: 3 additions & 3 deletions fr/controllers/components/authentication.rst
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,7 @@ utilisateur que vous voulez pour la 'connexion'::

public function register()
{
$user = $this->Users->newEntity($this->request->data);
$user = $this->Users->newEntity($this->request->data());
if ($this->Users->save($user)) {
$this->Auth->setUser($user->toArray());
return $this->redirect([
Expand Down Expand Up @@ -1089,12 +1089,12 @@ il peut donc être vérifié::
public function isAuthorized($user = null)
{
// Chacun des utilisateurs enregistrés peut accéder aux fonctions publiques
if (empty($this->request->params['prefix'])) {
if (!$this->request->param('prefix')) {
return true;
}

// Seulement les administrateurs peuvent accéder aux fonctions d'administration
if ($this->request->params['prefix'] === 'admin') {
if ($this->request->param('prefix') === 'admin') {
return (bool)($user['role'] === 'admin');
}

Expand Down
6 changes: 3 additions & 3 deletions fr/controllers/components/pagination.rst
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ personnalisée dans la propriété paginate::
// trouve les articles selon les tags
public function tags()
{
$tags = $this->request->params['pass'];
$tags = $this->request->param('pass');

$customFinderOptions = [
'tags' => $tags
Expand Down Expand Up @@ -138,7 +138,7 @@ créer les données paginées et ajouter le ``PaginatorHelper`` s'il n'a pas dé
été ajouté. La méthode paginate du controller va retourner l'ensemble des
résultats de la requête paginée, et définir les meta-données de pagination de
la requête. Vous pouvez accéder aux meta-données de pagination avec
``$this->request->params['paging']``. un exemple plus complet de l'utilisation
``$this->request->param('paging')``. un exemple plus complet de l'utilisation
de ``paginate()`` serait::

class ArticlesController extends AppController
Expand Down Expand Up @@ -291,7 +291,7 @@ utiliser un bloc try catch et faire des actions appropriées quand une
$this->paginate();
} catch (NotFoundException $e) {
// Faire quelque chose ici comme rediriger vers la première ou dernière page.
// $this->request->params['paging'] vous donnera les infos demandées.
// $this->request->param('paging') vous donnera les infos demandées.
}
}

Expand Down
4 changes: 2 additions & 2 deletions fr/controllers/components/request-handling.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ le layout et les fichiers de template par ceux qui correspondent au type demand
En outre, s'il existe un helper avec le même nom que l'extension demandée,
il sera ajouté au tableau des helpers des Controllers. Enfin, si une donnée
XML/JSON est POST'ée vers vos Controllers, elle sera décomposée dans un
tableau qui est assigné à ``$this->request->data``, et pourra alors être
tableau qui est assigné à ``$this->request->data()``, et pourra alors être
sauvegardée comme une donnée de model. Afin d'utiliser le Request Handler, il
doit être inclus dans votre tableau méthode ``initialize()``::

Expand Down Expand Up @@ -173,7 +173,7 @@ au callback, c'est très utile pour les callbacks comme ``json_decode``::
// Depuis 3.1.0, vous devez utiliser
$this->RequestHandler->config('inputTypeMap.json', ['json_decode', true]);

Le contenu ci-dessus créera ``$this->request->data`` un tableau des données
Le contenu ci-dessus créera ``$this->request->data()`` un tableau des données
d'entrées JSON, sans le ``true`` supplémentaire vous obtiendrez un jeu
d'objets ``stdClass``.

Expand Down
4 changes: 2 additions & 2 deletions fr/controllers/components/security.rst
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ de sécurité que vous voulez et le component Security les forcera au démarrage

public function beforeFilter(Event $event)
{
if (isset($this->request->params['admin'])) {
if ($this->request->param('admin')) {
$this->Security->requireSecure();
}
}
Expand Down Expand Up @@ -207,7 +207,7 @@ Cette exemple forcera toutes les actions qui proviennent de la "route" Admin à

public function forceSSL()
{
return $this->redirect('https://' . env('SERVER_NAME') . $this->request->here);
return $this->redirect('https://' . env('SERVER_NAME') . $this->request->here());
}
}

Expand Down
Loading

0 comments on commit 70a63c8

Please sign in to comment.