From db9635ec79f2653850f4eb01d506d19723632b78 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 9 Aug 2021 17:45:20 +0200 Subject: [PATCH] Deprecate the Request::get() method --- create_framework/front_controller.rst | 6 +++--- create_framework/http_foundation.rst | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/create_framework/front_controller.rst b/create_framework/front_controller.rst index e14f9f16d07..c4a321538a7 100644 --- a/create_framework/front_controller.rst +++ b/create_framework/front_controller.rst @@ -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(); @@ -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 @@ -190,7 +190,7 @@ And the ``hello.php`` script can now be converted to a template: .. code-block:: html+php - get('name', 'World') ?> + attributes->get('name', 'World') ?> Hello diff --git a/create_framework/http_foundation.rst b/create_framework/http_foundation.rst index 3c84dd25e57..3bec0dcea63 100644 --- a/create_framework/http_foundation.rst +++ b/create_framework/http_foundation.rst @@ -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')));