Skip to content

Commit d65f2ff

Browse files
committed
Merge branch '4.0' into 4.1
* 4.0: Improved the section about overriding bundle services Link to the env vars article from the Best Practices Added a caution note about race conditions in EntityType Minor reword of deployment article when using Flex Mention how to inject a specific Monolog service
2 parents e68cda5 + 6f3ef4d commit d65f2ff

File tree

7 files changed

+35
-44
lines changed

7 files changed

+35
-44
lines changed

best_practices/configuration.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ application behavior.
1717

1818
.. best-practice::
1919

20-
Define the infrastructure-related configuration options as environment
21-
variables. During development, use the ``.env`` file at the root of your
22-
project to set these.
20+
Define the infrastructure-related configuration options as
21+
:doc:`environment variables </configuration/external_parameters>`. During
22+
development, use the ``.env`` file at the root of your project to set these.
2323

2424
By default, Symfony adds these types of options to the ``.env`` file when
2525
installing new dependencies in the app:

bundles/override.rst

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -66,31 +66,12 @@ before the bundle one).
6666
Services & Configuration
6767
------------------------
6868

69-
If you want to modify service definitions of another bundle, you can use a compiler
70-
pass to change the class of the service or to modify method calls. In the following
71-
example, the implementing class for the ``original-service-id`` is changed to
72-
``App\YourService``:
73-
74-
.. code-block:: diff
75-
76-
// src/Kernel.php
77-
namespace App;
78-
79-
// ...
80-
+ use App\Service\YourService;
81-
+ use Symfony\Component\DependencyInjection\ContainerBuilder;
82-
+ use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
83-
84-
class Kernel extends BaseKernel implements CompilerPassInterface
85-
{
86-
+ public function process(ContainerBuilder $container)
87-
+ {
88-
+ $definition = $container->findDefinition('original-service-id');
89-
+ $definition->setClass(YourService::class);
90-
+ }
91-
}
92-
93-
For more information on compiler passes, see :doc:`/service_container/compiler_passes`.
69+
If you want to modify the services created by a bundle, you can use
70+
:doc:`service decoration </service_container/service_decoration>`.
71+
72+
If you want to do more advanced manipulations, like removing services created by
73+
other bundles, you must work with :doc:`service definitions </service_container/definitions>`
74+
inside a :doc:`compiler pass </service_container/compiler_passes>`.
9475

9576
Entities & Entity Mapping
9677
-------------------------

deployment.rst

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,9 @@ How you set environment variables, depends on your setup: they can be set at the
132132
command line, in your Nginx configuration, or via other methods provided by your
133133
hosting service.
134134

135-
At the very least you need to define the ``SYMFONY_ENV=prod`` (or
136-
``APP_ENV=prod`` if you're using :doc:`Symfony Flex </setup/flex>`) to run the
137-
application in ``prod`` mode, but depending on your application you may need to
138-
define other env vars too.
135+
At the very least you need to define the ``APP_ENV=prod`` environment variable
136+
to run the application in ``prod`` mode, but depending on your application you
137+
may need to define other env vars too.
139138

140139
C) Install/Update your Vendors
141140
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

frontend/encore/simple-example.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,4 +202,4 @@ If those entries include CSS/Sass files (e.g. ``homepage.js`` requires
202202
Keep Going!
203203
-----------
204204

205-
Go back to the :ref:`Encore Top List <encore-toc>` to learn more and add new features.
205+
Go back to the :ref:`List of Encore Articles <encore-toc>` to learn more and add new features.

logging/channels_handlers.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,5 +168,7 @@ You can also configure additional channels without the need to tag your services
168168
),
169169
));
170170
171-
With this, you can now send log messages to the ``foo`` channel by using
172-
the automatically registered logger service ``monolog.logger.foo``.
171+
Symfony automatically registers one service per channel (in this example, the
172+
channel ``foo`` creates a service called ``monolog.logger.foo``). In order to
173+
inject this service into others, you must update the service configuration to
174+
:ref:`choose the specific service to inject <services-wire-specific-service>`.

reference/constraints/UniqueEntity.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,13 @@ between all of the constraints in your user table:
109109
}
110110
}
111111
112+
.. caution::
113+
114+
This constraint doesn't provide any protection against `race conditions`_.
115+
They may occur when another entity is persisted by an external process after
116+
this validation has passed and before this entity is actually persisted in
117+
the database.
118+
112119
Options
113120
-------
114121

@@ -280,3 +287,5 @@ If set to ``false``, only one ``null`` value is allowed - if a second entity
280287
also has a ``null`` value, validation would fail.
281288

282289
.. include:: /reference/constraints/_payload-option.rst.inc
290+
291+
.. _`race conditions`: https://en.wikipedia.org/wiki/Race_condition

service_container/compiler_passes.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
How to Work with Compiler Passes
66
================================
77

8-
Compiler passes give you an opportunity to manipulate other service
9-
definitions that have been registered with the service container. You
10-
can read about how to create them in the components section
11-
":ref:`components-di-separate-compiler-passes`".
8+
Compiler passes give you an opportunity to manipulate other
9+
:doc:`service definitions </service_container/definitions>` that have been
10+
registered with the service container. You can read about how to create them in
11+
the components section ":ref:`components-di-separate-compiler-passes`".
1212

1313
Compiler passes are registered in the ``build()`` method of the application kernel::
1414

@@ -89,8 +89,8 @@ method in the extension)::
8989
}
9090
}
9191

92-
If you are using custom service tags in a bundle then by convention, tag names
93-
consist of the name of the bundle (lowercase, underscores as separators),
94-
followed by a dot, and finally the "real" name. For example, if you want to
95-
introduce some sort of "transport" tag in your AcmeMailerBundle, you should call
96-
it ``acme_mailer.transport``.
92+
If you are using custom :doc:`service tags </service_container/tags>` in a
93+
bundle then by convention, tag names consist of the name of the bundle
94+
(lowercase, underscores as separators), followed by a dot, and finally the
95+
"real" name. For example, if you want to introduce some sort of "transport" tag
96+
in your AcmeMailerBundle, you should call it ``acme_mailer.transport``.

0 commit comments

Comments
 (0)