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

Removed the deprecated factory YAML config#11625

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
javiereguiluz merged 1 commit intosymfony:3.4fromjaviereguiluz:backport_11589
May 31, 2019
Merged
Show file tree
Hide file tree
Changes fromall 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
20 changes: 2 additions & 18 deletionsservice_container/configurators.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -136,10 +136,10 @@ all the classes are already loaded as services. All you need to do is specify th

# override the services to set the configurator
AppBundle\Mail\NewsletterManager:
configurator:'AppBundle\Mail\EmailConfigurator:configure'
configurator:['@AppBundle\Mail\EmailConfigurator', 'configure']

AppBundle\Mail\GreetingCardManager:
configurator:'AppBundle\Mail\EmailConfigurator:configure'
configurator:['@AppBundle\Mail\EmailConfigurator', 'configure']

.. code-block:: xml

Expand DownExpand Up@@ -184,22 +184,6 @@ all the classes are already loaded as services. All you need to do is specify th
$container->getDefinition(GreetingCardManager::class)
->setConfigurator([new Reference(EmailConfigurator::class), 'configure']);

.. versionadded:: 3.2

The ``service_id:method_name`` syntax for the YAML configuration format
was introduced in Symfony 3.2.

The traditional configurator syntax in YAML files used an array to define
the service id and the method name:

.. code-block:: yaml

app.newsletter_manager:
# new syntax
configurator: 'AppBundle\Mail\EmailConfigurator:configure'
# old syntax
configurator: ['@AppBundle\Mail\EmailConfigurator', configure]

That's it! When requesting the ``AppBundle\Mail\NewsletterManager`` or
``AppBundle\Mail\GreetingCardManager`` service, the created instance will first be
passed to the ``EmailConfigurator::configure()`` method.
19 changes: 2 additions & 17 deletionsservice_container/factories.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -41,7 +41,7 @@ configure the service container to use the

AppBundle\Email\NewsletterManager:
# call the static method that creates the object
factory: ['AppBundle\Email\NewsletterManagerStaticFactory', createNewsletterManager]
factory: ['AppBundle\Email\NewsletterManagerStaticFactory','createNewsletterManager']
# define the class of the created object
class: AppBundle\Email\NewsletterManager

Expand DownExpand Up@@ -107,7 +107,7 @@ Configuration of the service container then looks like this:

AppBundle\Email\NewsletterManager:
# call a method on the specified factory service
factory:'AppBundle\Email\NewsletterManagerFactory:createNewsletterManager'
factory:['@AppBundle\Email\NewsletterManagerFactory', 'createNewsletterManager']
class: AppBundle\Email\NewsletterManager

.. code-block:: xml
Expand DownExpand Up@@ -150,21 +150,6 @@ Configuration of the service container then looks like this:
'createNewsletterManager',
]);

.. note::

The traditional configuration syntax in YAML files used an array to define
the factory service and the method name:

.. code-block:: yaml

# app/config/services.yml
AppBundle\Email\NewsletterManager:
class: AppBundle\Email\NewsletterManager
# new syntax
factory: 'AppBundle\Email\NewsletterManagerFactory:createNewsletterManager'
# old syntax
factory: ['@AppBundle\Email\NewsletterManagerFactory', createNewsletterManager]

.. _factories-passing-arguments-factory-method:

Passing Arguments to the Factory Method
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp