Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commitbf740fb

Browse files
committed
Applied comments
1 parentd0e971d commitbf740fb

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

‎components/dependency_injection/compilation.rst‎

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,7 @@ For more details, see :doc:`/cookbook/bundles/prepend_extension`, which
306306
is specific to the Symfony Framework, but contains more details about this
307307
feature.
308308

309+
.. _creating-a-compiler-pass:
309310
.. _components-di-compiler-pass:
310311

311312
Execute Code During Compilation
@@ -332,8 +333,8 @@ compilation::
332333

333334
..versionadded::2.8
334335
Prior to Symfony 2.8, extensions implementing ``CompilerPassInterface``
335-
were not automatically registered. Youneed to registerit as explained in
336-
:ref:`the next section<components-di-separate-compiler-passes>`.
336+
were not automatically registered. Youneeded to registerthem as explained
337+
in:ref:`the next section<components-di-separate-compiler-passes>`.
337338

338339
As ``process()`` is called *after* all extensions are loaded, it allows you to
339340
edit service definitions of other extensions as well as retrieving information
@@ -342,10 +343,17 @@ about service definitions.
342343
The container's parameters and definitions can be manipulated using the
343344
methods described in:doc:`/components/dependency_injection/definitions`.
344345

346+
..note::
347+
348+
Please note that the ``process()`` method in the extension classes is
349+
called during the optimization step. You can read
350+
:ref:`the next section<components-di-separate-compiler-passes>` if you
351+
need to edit the container during another step.
352+
345353
..note::
346354

347355
As a rule, only work with services definition in a compiler pass and do not
348-
create service instances.Practically, this means using methods ``has()``,
356+
create service instances.In practice, this means using methods ``has()``,
349357
``findDefinition()``, ``getDefinition()``, ``setDefinition()``, etc.
350358
instead of ``get()``, ``set()``, etc.
351359

@@ -364,9 +372,10 @@ for an example.
364372
Creating Separate Compiler Passes
365373
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
366374

367-
Sometimes, you need to do more than one thing during compliation or want to use
368-
compiler passes without an extension. In this case, you can create a new class
369-
implementing the ``CompilerPassInterface``::
375+
Sometimes, you need to do more than one thing during compliation, want to use
376+
compiler passes without an extension or you need to execute some code at
377+
another step in the compilation process. In these cases, you can create a new
378+
class implementing the ``CompilerPassInterface``::
370379

371380
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
372381
use Symfony\Component\DependencyInjection\ContainerBuilder;

‎components/dependency_injection/tags.rst‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,10 @@ the custom tag that you'll use in your compiler pass. The compiler pass
118118
is what makes this tag "mean" something.
119119

120120
.. _components-di-compiler-pass-tags:
121+
.. _create-a-compilerpass:
121122

122-
Create aCompilerPass
123-
---------------------
123+
Create aCompiler Pass
124+
----------------------
124125

125126
You can now use a:ref:`compiler pass<components-di-separate-compiler-passes>` to ask the
126127
container for any services with the ``acme_mailer.transport`` tag::

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp