@@ -623,8 +623,8 @@ For example, imagine you're processing a :doc:`form </forms>` submission::
623
623
624
624
.. _request-object-info :
625
625
626
- The Request Object
627
- ------------------
626
+ The Request and Response Object
627
+ -------------------------------
628
628
629
629
As mentioned :ref: `earlier <controller-request-argument >`, Symfony will
630
630
pass the ``Request `` object to any controller argument that is type-hinted with
@@ -660,36 +660,6 @@ the ``Request`` class::
660
660
The ``Request `` class has several public properties and methods that return any
661
661
information you need about the request.
662
662
663
- For example, the method ``getPreferredLanguage `` accepts an array of preferred languages and
664
- returns the best language for the user, based on the ``Accept-Language `` header.
665
- The locale is returned with language, script and region, if available (e.g. ``en_US ``, ``fr_Latn_CH `` or ``pt ``).
666
-
667
- Before Symfony 7.1, this method had the following logic:
668
-
669
- 1. If no locale is set as a parameter, it returns the first language in the
670
- ``Accept-Language `` header or ``null `` if the header is empty
671
- 2. If no ``Accept-Language `` header is set, it returns the first locale passed
672
- as a parameter.
673
- 3. If a locale is set as a parameter and in the ``Accept-Language `` header,
674
- it returns the first exact match.
675
- 4. Then, it returns the first language passed in the ``Accept-Language `` header or as argument.
676
-
677
- Starting from Symfony 7.1, the method has an additional step:
678
-
679
- 1. If no locale is set as a parameter, it returns the first language in the
680
- ``Accept-Language `` header or ``null `` if the header is empty
681
- 2. If no ``Accept-Language `` header is set, it returns the first locale passed
682
- as a parameter.
683
- 3. If a locale is set as a parameter and in the ``Accept-Language `` header,
684
- it returns the first exact match.
685
- 4. If a language matches the locale, but has a different script or region, it returns the first language in the
686
- ``Accept-Language `` header that matches the locale's language, script or region combination
687
- (e.g. ``fr_CA `` will match ``fr_FR ``).
688
- 5. Then, it returns the first language passed in the ``Accept-Language `` header or as argument.
689
-
690
- The Response Object
691
- -------------------
692
-
693
663
Like the ``Request ``, the ``Response `` object has a public ``headers `` property.
694
664
This object is of the type :class: `Symfony\\ Component\\ HttpFoundation\\ ResponseHeaderBag `
695
665
and provides methods for getting and setting response headers. The header names are
0 commit comments