Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f8c1e14

Browse filesBrowse files
committed
Merge branch '5.0'
* 5.0: Update http_authentication.rst Update routing.rst Update routing.rst Update mailer.rst Update messenger.rst Reference method Update form.rst Use valid versionj in maintainer guide. refs #13175 [DependencyInjection] Fixed public service use case Use valid version in maintainer guide Mention region parameter for Mailgun mailer too
2 parents 97ce202 + e32eef5 commit f8c1e14
Copy full SHA for f8c1e14

File tree

8 files changed

+84
-52
lines changed
Filter options

8 files changed

+84
-52
lines changed

‎_build/maintainer_guide.rst

Copy file name to clipboardExpand all lines: _build/maintainer_guide.rst
+27-27Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,9 @@ original contributor.
134134
$ cd symfony-docs/
135135
136136
# make sure that your local branch is updated
137-
$ git checkout 3.4
137+
$ git checkout 4.4
138138
$ git fetch upstream
139-
$ git merge upstream/3.4
139+
$ git merge upstream/4.4
140140
141141
# merge any PR passing its GitHub number as argument
142142
$ gh merge 11159
@@ -153,20 +153,20 @@ the ``-s`` option:
153153

154154
.. code-block:: terminal
155155
156-
# e.g. this PR was sent against 'master', but it's merged in '3.4'
157-
$ gh merge 11160 -s 3.4
156+
# e.g. this PR was sent against 'master', but it's merged in '4.4'
157+
$ gh merge 11160 -s 4.4
158158
159159
Sometimes, when changing the branch, you may face rebase issues, but they are
160160
usually simple to fix:
161161

162162
.. code-block:: terminal
163163
164-
$ gh merge 11160 -s 3.4
164+
$ gh merge 11160 -s 4.4
165165
166166
...
167167
168168
Unable to rebase the patch for <comment>pull/11183</comment>
169-
The command "'git' 'rebase' '--onto' '3.4' '4.2' 'pull/11160'" failed.
169+
The command "'git' 'rebase' '--onto' '4.4' '5.0' 'pull/11160'" failed.
170170
Exit Code: 128(Invalid exit argument)
171171
172172
[...]
@@ -183,7 +183,7 @@ usually simple to fix:
183183
184184
# Lastly, re-run the exact same original command that resulted in a conflict
185185
# There's no need to change the branch or do anything else.
186-
$ gh merge 11160 -s 3.4
186+
$ gh merge 11160 -s 4.4
187187
188188
The previous run had some conflicts. Do you want to resume the merge? (Y/n)
189189
@@ -195,29 +195,29 @@ Step 3: Merge it into the other branches
195195

196196
If a PR has not been merged in ``master``, you must merge it up into all the
197197
maintained branches until ``master``. Imagine that you are merging a PR against
198-
``3.4`` and the maintained branches are ``3.4``, ``4.2`` and ``master``:
198+
``4.4`` and the maintained branches are ``4.4``, ``5.0`` and ``master``:
199199

200200
.. code-block:: terminal
201201
202202
$ git fetch upstream
203203
204-
$ git checkout 3.4
205-
$ git merge upstream/3.4
204+
$ git checkout 4.4
205+
$ git merge upstream/4.4
206206
207207
$ gh merge 11159
208208
$ git push origin
209209
$ git push upstream
210210
211-
$ git checkout 4.2
212-
$ git merge upstream/4.2
213-
$ git merge --log 3.4
211+
$ git checkout 5.0
212+
$ git merge upstream/5.0
213+
$ git merge --log 4.4
214214
# here you can face several errors explained later
215215
$ git push origin
216216
$ git push upstream
217217
218218
$ git checkout master
219219
$ git merge upstream/master
220-
$ git merge --log 4.2
220+
$ git merge --log 5.0
221221
$ git push origin
222222
$ git push upstream
223223
@@ -247,26 +247,26 @@ When updating your local branches before merging:
247247
.. code-block:: terminal
248248
249249
$ git fetch upstream
250-
$ git checkout 3.4
251-
$ git merge upstream/3.4
250+
$ git checkout 4.4
251+
$ git merge upstream/4.4
252252
253253
It's possible that you merge a wrong upstream branch unawarely. It's usually
254254
easy to spot because you'll see lots of conflicts:
255255

256256
.. code-block:: terminal
257257
258258
# DON'T DO THIS! It's a wrong branch merge
259-
$ git checkout 3.4
260-
$ git merge upstream/4.2
259+
$ git checkout 4.4
260+
$ git merge upstream/5.0
261261
262262
As long as you don't push this wrong merge, there's no problem. Delete your
263263
local branch and check it out again:
264264

265265
.. code-block:: terminal
266266
267267
$ git checkout master
268-
$ git branch -D 3.4
269-
$ git checkout 3.4 upstream/3.4
268+
$ git branch -D 4.4
269+
$ git checkout 4.4 upstream/4.4
270270
271271
If you did push the wrong branch merge, ask for help in the documentation
272272
mergers chat and we'll help solve the problem.
@@ -278,9 +278,9 @@ When merging things to upper branches, most of the times you'll see conflicts:
278278

279279
.. code-block:: terminal
280280
281-
$ git checkout 4.2
282-
$ git merge upstream/4.2
283-
$ git merge --log 3.4
281+
$ git checkout 5.0
282+
$ git merge upstream/5.0
283+
$ git merge --log 4.4
284284
285285
Auto-merging security/entity_provider.rst
286286
Auto-merging logging/monolog_console.rst
@@ -314,13 +314,13 @@ were modified by the PR but no longer exist in newer branches:
314314

315315
.. code-block:: terminal
316316
317-
$ git checkout 4.2
318-
$ git merge upstream/4.2
319-
$ git merge --log 3.4
317+
$ git checkout 5.0
318+
$ git merge upstream/5.0
319+
$ git merge --log 4.4
320320
321321
Auto-merging translation/debug.rst
322322
CONFLICT (modify/delete): service_container/scopes.rst deleted in HEAD and
323-
modified in 3.4. Version 3.4 of service_container/scopes.rst left in tree.
323+
modified in 4.4. Version 4.4 of service_container/scopes.rst left in tree.
324324
Auto-merging service_container.rst
325325
326326
If the contents of the deleted file were moved to a different file in newer

‎components/form.rst

Copy file name to clipboardExpand all lines: components/form.rst
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ Changing a Form's Method and Action
535535
By default, a form is submitted to the same URI that rendered the form with
536536
an HTTP POST request. This behavior can be changed using the :ref:`form-option-action`
537537
and :ref:`form-option-method` options (the ``method`` option is also used
538-
by ``handleRequest()`` to determine whether a form has been submitted):
538+
by :method:`Symfony\\Component\\Form\\Form::handleRequest` to determine whether a form has been submitted):
539539

540540
.. configuration-block::
541541

@@ -651,15 +651,15 @@ This defines a common form "workflow", which contains 3 different possibilities:
651651
1) On the initial GET request (i.e. when the user "surfs" to your page),
652652
build your form and render it;
653653

654-
If the request is a POST, process the submitted data (via ``handleRequest()``).
654+
If the request is a POST, process the submitted data (via :method:`Symfony\\Component\\Form\\Form::handleRequest`).
655655
Then:
656656

657657
2) if the form is invalid, re-render the form (which will now contain errors);
658658
3) if the form is valid, perform some action and redirect.
659659

660660
Luckily, you don't need to decide whether or not a form has been submitted.
661-
Pass the current request to the ``handleRequest()`` method. Then, the Form
662-
component will do all the necessary work for you.
661+
Just pass the current request to the :method:`Symfony\\Component\\Form\\Form::handleRequest`
662+
method. Then, the Form component will do all the necessary work for you.
663663

664664
.. _component-form-intro-validation:
665665

‎mailer.rst

Copy file name to clipboardExpand all lines: mailer.rst
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ The *only* part you need to change is to replace ``KEY`` in the ``MAILER_DSN`` (
7474
Each provider has different environment variables that the Mailer uses to
7575
configure the *actual* protocol, address and authentication for delivery. Some
7676
also have options that can be configured with query parameters at the end of the
77-
``MAILER_DSN`` - like ``?region=`` for Amazon SES. Some providers support
77+
``MAILER_DSN`` - like ``?region=`` for Amazon SES or Mailgun. Some providers support
7878
sending via ``http``, ``api`` or ``smtp``. Symfony chooses the best available
7979
transport, but you can force to use one:
8080

@@ -562,7 +562,7 @@ encrypt a signed message and/or to sign an encrypted message.
562562
Before signing/encrypting messages, make sure to have:
563563

564564
* The `OpenSSL PHP extension`_ properly installed and configured;
565-
* A valid S/MIME security certificate.
565+
* A valid `S/MIME`_ security certificate.
566566

567567
Signing Messages
568568
~~~~~~~~~~~~~~~~

‎messenger.rst

Copy file name to clipboardExpand all lines: messenger.rst
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ install messenger:
1717

1818
.. code-block:: terminal
1919
20-
$ composer require messenger
20+
$ composer require symfony/messenger
2121
2222
Creating a Message & Handler
2323
----------------------------
@@ -321,6 +321,9 @@ If you need to pass a Doctrine entity in a message, it's better to pass the enti
321321
primary key (or whatever relevant information the handler actually needs, like ``email``,
322322
etc) instead of the object::
323323

324+
// src/Message/NewUserWelcomeEmail.php
325+
namespace App\Message;
326+
324327
class NewUserWelcomeEmail
325328
{
326329
private $userId;

‎routing.rst

Copy file name to clipboardExpand all lines: routing.rst
+10-3Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,14 @@ following configuration file:
3434

3535
.. code-block:: yaml
3636
37-
# config/routes.yaml
37+
# config/routes/annotations.yaml
3838
controllers:
39-
resource: '../src/Controller/'
40-
type: annotation
39+
resource: '../../src/Controller/'
40+
type: annotation
41+
42+
kernel:
43+
resource: ../../src/Kernel.php
44+
type: annotation
4145
4246
This configuration tells Symfony to look for routes defined as annotations in
4347
any PHP class stored in the ``src/Controller/`` directory.
@@ -1946,6 +1950,9 @@ This information can be configured per command too::
19461950
// src/Command/SomeCommand.php
19471951
namespace App\Command;
19481952

1953+
use Symfony\Component\Console\Command\Command;
1954+
use Symfony\Component\Console\Input\InputInterface;
1955+
use Symfony\Component\Console\Output\OutputInterface;
19491956
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
19501957
use Symfony\Component\Routing\RouterInterface;
19511958
// ...

‎service_container.rst

Copy file name to clipboardExpand all lines: service_container.rst
+34-14Lines changed: 34 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -807,20 +807,35 @@ Public Versus Private Services
807807
From Symfony 4.0, every service defined is private by default.
808808

809809
What does this mean? When a service **is** public, you can access it directly
810-
from the container object, which is accessible from any controller that extends
811-
:class:`Symfony\\Bundle\\FrameworkBundle\\Controller\\AbstractController`::
810+
from the container object, which can also be injected thanks to autowiring.
811+
This is mostly useful when you want to fetch services lazily::
812812

813-
use App\Service\MessageGenerator;
813+
namespace App\Generator;
814814

815-
// ...
816-
public function new()
815+
use Psr\Container\ContainerInterface;
816+
817+
class MessageGenerator
817818
{
818-
// there IS a public "logger" service in the container
819-
$logger = $this->container->get('logger');
819+
private $container;
820820

821-
// this will NOT work: MessageGenerator is a private service
822-
$generator = $this->container->get(MessageGenerator::class);
823-
}
821+
public function __construct(ContainerInterface $container)
822+
{
823+
$this->container = $container;
824+
}
825+
826+
public function generate(string $message, string $template = null, array $context = []): string
827+
{
828+
if ($template && $this->container->has('twig')) {
829+
// there IS a public "twig" service in the container
830+
$twig = $this->container->get('twig');
831+
832+
return $twig->render($template, $context + ['message' => $message]);
833+
}
834+
835+
// if no template is passed, the "twig" service will not be loaded
836+
837+
// ...
838+
}
824839

825840
As a best practice, you should only create *private* services, which will happen
826841
automatically. And also, you should *not* use the ``$container->get()`` method to
@@ -837,7 +852,7 @@ But, if you *do* need to make a service public, override the ``public`` setting:
837852
# ... same code as before
838853
839854
# explicitly configure the service
840-
App\Service\MessageGenerator:
855+
Acme\PublicService:
841856
public: true
842857
843858
.. code-block:: xml
@@ -853,7 +868,7 @@ But, if you *do* need to make a service public, override the ``public`` setting:
853868
<!-- ... same code as before -->
854869
855870
<!-- Explicitly configure the service -->
856-
<service id="App\Service\MessageGenerator" public="true"></service>
871+
<service id="Acme\PublicService" public="true"></service>
857872
</services>
858873
</container>
859874
@@ -862,17 +877,22 @@ But, if you *do* need to make a service public, override the ``public`` setting:
862877
// config/services.php
863878
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
864879
865-
use App\Service\MessageGenerator;
880+
use Acme\PublicService;
866881
867882
return function(ContainerConfigurator $configurator) {
868883
// ... same as code before
869884
870885
// explicitly configure the service
871-
$services->set(MessageGenerator::class)
886+
$services->set(PublicService::class)
872887
->public()
873888
;
874889
};
875890
891+
.. note::
892+
893+
Instead of injecting the container you should consider using a
894+
:ref:`service locator <service-locators>` instead.
895+
876896
.. _service-psr4-loader:
877897

878898
Importing Many Services at once with resource

‎service_container/service_subscribers_locators.rst

Copy file name to clipboardExpand all lines: service_container/service_subscribers_locators.rst
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
.. index::
22
single: DependencyInjection; Service Subscribers
33

4+
.. _service-locators:
5+
46
Service Subscribers & Locators
57
==============================
68

‎testing/http_authentication.rst

Copy file name to clipboardExpand all lines: testing/http_authentication.rst
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ needs::
111111

112112
private function logIn()
113113
{
114-
$session = $this->client->getContainer()->get('session');
114+
$session = self::$container->get('session');
115115

116116
$firewallName = 'secure_area';
117117
// if you don't define multiple connected firewalls, the context defaults to the firewall name

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.