Skip to content

rename master request to main request #15156

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
Apr 20, 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
12 changes: 6 additions & 6 deletions components/http_kernel.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ that system::
*/
public function handle(
Request $request,
int $type = self::MASTER_REQUEST,
int $type = self::MAIN_REQUEST,
bool $catch = true
);
}
Expand Down Expand Up @@ -701,20 +701,20 @@ argument as follows::

This creates another full request-response cycle where this new ``Request`` is
transformed into a ``Response``. The only difference internally is that some
listeners (e.g. security) may only act upon the master request. Each listener
listeners (e.g. security) may only act upon the main request. Each listener
is passed some sub-class of :class:`Symfony\\Component\\HttpKernel\\Event\\KernelEvent`,
whose :method:`Symfony\\Component\\HttpKernel\\Event\\KernelEvent::isMasterRequest`
can be used to check if the current request is a "master" or "sub" request.
whose :method:`Symfony\\Component\\HttpKernel\\Event\\KernelEvent::isMainRequest`
can be used to check if the current request is a "main" or "sub" request.

For example, a listener that only needs to act on the master request may
For example, a listener that only needs to act on the main request may
look like this::

use Symfony\Component\HttpKernel\Event\RequestEvent;
// ...

public function onKernelRequest(RequestEvent $event)
{
if (!$event->isMasterRequest()) {
if (!$event->isMainRequest()) {
return;
}

Expand Down
4 changes: 2 additions & 2 deletions create_framework/http_kernel_httpkernelinterface.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ goal by making our framework implement ``HttpKernelInterface``::
*/
public function handle(
Request $request,
$type = self::MASTER_REQUEST,
$type = self::MAIN_REQUEST,
$catch = true
);
}
Expand All @@ -39,7 +39,7 @@ Update your framework so that it implements this interface::

public function handle(
Request $request,
$type = HttpKernelInterface::MASTER_REQUEST,
$type = HttpKernelInterface::MAIN_REQUEST,
$catch = true
) {
// ...
Expand Down
8 changes: 4 additions & 4 deletions event_dispatcher.rst
Original file line number Diff line number Diff line change
Expand Up @@ -206,10 +206,10 @@ the ``EventSubscriber`` directory. Symfony takes care of the rest.
Request Events, Checking Types
------------------------------

A single page can make several requests (one master request, and then multiple
A single page can make several requests (one main request, and then multiple
sub-requests - typically when :ref:`embedding controllers in templates <templates-embed-controllers>`).
For the core Symfony events, you might need to check to see if the event is for
a "master" request or a "sub request"::
a "main" request or a "sub request"::

// src/EventListener/RequestListener.php
namespace App\EventListener;
Expand All @@ -220,8 +220,8 @@ a "master" request or a "sub request"::
{
public function onKernelRequest(RequestEvent $event)
{
if (!$event->isMasterRequest()) {
// don't do anything if it's not the master request
if (!$event->isMainRequest()) {
// don't do anything if it's not the main request
return;
}

Expand Down
2 changes: 1 addition & 1 deletion http_cache.rst
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ header to the response. You can also use the ``trace_level`` config
option and set it to either ``none``, ``short`` or ``full`` to
add this information.

``short`` will add the information for the master request only.
``short`` will add the information for the main request only.
It's written in a concise way that makes it easy to record the
information in your server log files. For example, in Apache you can
use ``%{X-Symfony-Cache}o`` in ``LogFormat`` format statements.
Expand Down
2 changes: 1 addition & 1 deletion http_cache/esi.rst
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ used ``render()``.
contains the ``ESI/1.0`` string anywhere.

The embedded action can now specify its own caching rules entirely independently
of the master page::
of the main page::

// src/Controller/NewsController.php
namespace App\Controller;
Expand Down
8 changes: 4 additions & 4 deletions reference/configuration/framework.rst
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ Configuration
* :ref:`dsn <profiler-dsn>`
* :ref:`enabled <reference-profiler-enabled>`
* `only_exceptions`_
* `only_master_requests`_
* `only_main_requests`_

* `property_access`_

Expand Down Expand Up @@ -1244,12 +1244,12 @@ only_exceptions
When this is set to ``true``, the profiler will only be enabled when an
exception is thrown during the handling of the request.

only_master_requests
....................
only_main_requests
..................

**type**: ``boolean`` **default**: ``false``

When this is set to ``true``, the profiler will only be enabled on the master
When this is set to ``true``, the profiler will only be enabled on the main
requests (and not on the subrequests).

.. _profiler-dsn:
Expand Down
6 changes: 3 additions & 3 deletions reference/events.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Each event dispatched by the HttpKernel component is a subclass of
following information:

:method:`Symfony\\Component\\HttpKernel\\Event\\KernelEvent::getRequestType`
Returns the *type* of the request (``HttpKernelInterface::MASTER_REQUEST``
Returns the *type* of the request (``HttpKernelInterface::MAIN_REQUEST``
or ``HttpKernelInterface::SUB_REQUEST``).

:method:`Symfony\\Component\\HttpKernel\\Event\\KernelEvent::getKernel`
Expand All @@ -24,8 +24,8 @@ following information:
:method:`Symfony\\Component\\HttpKernel\\Event\\KernelEvent::getRequest`
Returns the current ``Request`` being handled.

:method:`Symfony\\Component\\HttpKernel\\Event\\KernelEvent::isMasterRequest`
Checks if this is a master request.
:method:`Symfony\\Component\\HttpKernel\\Event\\KernelEvent::isMainRequest`
Checks if this is a main request.

.. _kernel-core-request:

Expand Down
2 changes: 1 addition & 1 deletion security/form_login_setup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ whenever the user browses a page::
{
$request = $event->getRequest();
if (
!$event->isMasterRequest()
!$event->isMainRequest()
|| $request->isXmlHttpRequest()
|| 'app_login' === $request->attributes->get('_route')
) {
Expand Down
2 changes: 1 addition & 1 deletion session.rst
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ your ``Session`` object with the default ``AttributeBag`` by the ``NamespacedAtt
public function createSession(): SessionInterface
{
return new Session(
$this->storageFactory->createStorage($this->requestStack->getMasterRequest()),
$this->storageFactory->createStorage($this->requestStack->getMainRequest()),
$this->sessionAttributes,
null,
$this->usageReporter
Expand Down