Skip to content

Deprecate the Request::get() method #15610

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions create_framework/front_controller.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Let's see it in action::
// framework/index.php
require_once __DIR__.'/init.php';

$name = $request->get('name', 'World');
$name = $request->attributes->get('name', 'World');

$response->setContent(sprintf('Hello %s', htmlspecialchars($name, ENT_QUOTES, 'UTF-8')));
$response->send();
Expand Down Expand Up @@ -98,7 +98,7 @@ Such a script might look like the following::
And here is for instance the new ``hello.php`` script::

// framework/hello.php
$name = $request->get('name', 'World');
$name = $request->attributes->get('name', 'World');
$response->setContent(sprintf('Hello %s', htmlspecialchars($name, ENT_QUOTES, 'UTF-8')));

In the ``front.php`` script, ``$map`` associates URL paths with their
Expand Down Expand Up @@ -190,7 +190,7 @@ And the ``hello.php`` script can now be converted to a template:
.. code-block:: html+php

<!-- example.com/src/pages/hello.php -->
<?php $name = $request->get('name', 'World') ?>
<?php $name = $request->attributes->get('name', 'World') ?>

Hello <?= htmlspecialchars($name, ENT_QUOTES, 'UTF-8') ?>

Expand Down
2 changes: 1 addition & 1 deletion create_framework/http_foundation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ Now, let's rewrite our application by using the ``Request`` and the

$request = Request::createFromGlobals();

$name = $request->get('name', 'World');
$name = $request->attributes->get('name', 'World');

$response = new Response(sprintf('Hello %s', htmlspecialchars($name, ENT_QUOTES, 'UTF-8')));

Expand Down