diff --git a/best_practices/business-logic.rst b/best_practices/business-logic.rst
index 06ecb72795a..8a23dca6b49 100644
--- a/best_practices/business-logic.rst
+++ b/best_practices/business-logic.rst
@@ -140,12 +140,9 @@ the class namespace as a parameter:
# app/config/services.yml
# service definition with class namespace as parameter
- parameters:
- slugger.class: AppBundle\Utils\Slugger
-
services:
app.slugger:
- class: "%slugger.class%"
+ class: AppBundle\Utils\Slugger
This practice is cumbersome and completely unnecessary for your own services:
diff --git a/book/service_container.rst b/book/service_container.rst
index fc08fedba7c..ea1996179b2 100644
--- a/book/service_container.rst
+++ b/book/service_container.rst
@@ -203,12 +203,11 @@ straightforward. Parameters make defining services more organized and flexible:
# app/config/config.yml
parameters:
- my_mailer.class: Acme\HelloBundle\Mailer
my_mailer.transport: sendmail
services:
my_mailer:
- class: "%my_mailer.class%"
+ class: Acme\HelloBundle\Mailer
arguments: ["%my_mailer.transport%"]
.. code-block:: xml
@@ -220,12 +219,11 @@ straightforward. Parameters make defining services more organized and flexible:
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
- Acme\HelloBundle\Mailer
sendmail
-
+
%my_mailer.transport%
@@ -236,19 +234,18 @@ straightforward. Parameters make defining services more organized and flexible:
// app/config/config.php
use Symfony\Component\DependencyInjection\Definition;
- $container->setParameter('my_mailer.class', 'Acme\HelloBundle\Mailer');
$container->setParameter('my_mailer.transport', 'sendmail');
$container->setDefinition('my_mailer', new Definition(
- '%my_mailer.class%',
+ 'Acme\HelloBundle\Mailer',
array('%my_mailer.transport%')
));
The end result is exactly the same as before - the difference is only in
-*how* you defined the service. By surrounding the ``my_mailer.class`` and
-``my_mailer.transport`` strings in percent (``%``) signs, the container knows
-to look for parameters with those names. When the container is built, it
-looks up the value of each parameter and uses it in the service definition.
+*how* you defined the service. By surrounding the ``my_mailer.transport``
+string in percent (``%``) signs, the container knows to look for a parameter
+with that name. When the container is built, it looks up the value of each
+parameter and uses it in the service definition.
.. note::
@@ -348,12 +345,11 @@ directories don't exist, create them.
# src/Acme/HelloBundle/Resources/config/services.yml
parameters:
- my_mailer.class: Acme\HelloBundle\Mailer
my_mailer.transport: sendmail
services:
my_mailer:
- class: "%my_mailer.class%"
+ class: Acme\HelloBundle\Mailer
arguments: ["%my_mailer.transport%"]
.. code-block:: xml
@@ -365,12 +361,11 @@ directories don't exist, create them.
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
- Acme\HelloBundle\Mailer
sendmail
-
+
%my_mailer.transport%
@@ -381,11 +376,10 @@ directories don't exist, create them.
// src/Acme/HelloBundle/Resources/config/services.php
use Symfony\Component\DependencyInjection\Definition;
- $container->setParameter('my_mailer.class', 'Acme\HelloBundle\Mailer');
$container->setParameter('my_mailer.transport', 'sendmail');
$container->setDefinition('my_mailer', new Definition(
- '%my_mailer.class%',
+ 'Acme\HelloBundle\Mailer',
array('%my_mailer.transport%')
));
@@ -608,15 +602,11 @@ the service container gives you a much more appealing option:
.. code-block:: yaml
# src/Acme/HelloBundle/Resources/config/services.yml
- parameters:
- # ...
- newsletter_manager.class: Acme\HelloBundle\Newsletter\NewsletterManager
-
services:
my_mailer:
# ...
newsletter_manager:
- class: "%newsletter_manager.class%"
+ class: Acme\HelloBundle\Newsletter\NewsletterManager
arguments: ["@my_mailer"]
.. code-block:: xml
@@ -627,16 +617,11 @@ the service container gives you a much more appealing option:
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
-
-
- Acme\HelloBundle\Newsletter\NewsletterManager
-
-
-
+
@@ -648,15 +633,9 @@ the service container gives you a much more appealing option:
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Reference;
- // ...
- $container->setParameter(
- 'newsletter_manager.class',
- 'Acme\HelloBundle\Newsletter\NewsletterManager'
- );
-
$container->setDefinition('my_mailer', ...);
$container->setDefinition('newsletter_manager', new Definition(
- '%newsletter_manager.class%',
+ 'Acme\HelloBundle\Newsletter\NewsletterManager',
array(new Reference('my_mailer'))
));
@@ -704,15 +683,11 @@ Injecting the dependency by the setter method just needs a change of syntax:
.. code-block:: yaml
# src/Acme/HelloBundle/Resources/config/services.yml
- parameters:
- # ...
- newsletter_manager.class: Acme\HelloBundle\Newsletter\NewsletterManager
-
services:
my_mailer:
# ...
newsletter_manager:
- class: "%newsletter_manager.class%"
+ class: Acme\HelloBundle\Newsletter\NewsletterManager
calls:
- [setMailer, ["@my_mailer"]]
@@ -724,16 +699,11 @@ Injecting the dependency by the setter method just needs a change of syntax:
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
-
-
- Acme\HelloBundle\Newsletter\NewsletterManager
-
-
-
+
@@ -747,15 +717,9 @@ Injecting the dependency by the setter method just needs a change of syntax:
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Reference;
- // ...
- $container->setParameter(
- 'newsletter_manager.class',
- 'Acme\HelloBundle\Newsletter\NewsletterManager'
- );
-
$container->setDefinition('my_mailer', ...);
$container->setDefinition('newsletter_manager', new Definition(
- '%newsletter_manager.class%'
+ 'Acme\HelloBundle\Newsletter\NewsletterManager'
))->addMethodCall('setMailer', array(
new Reference('my_mailer'),
));
@@ -781,12 +745,9 @@ it exists and do nothing if it doesn't:
.. code-block:: yaml
# src/Acme/HelloBundle/Resources/config/services.yml
- parameters:
- # ...
-
services:
newsletter_manager:
- class: "%newsletter_manager.class%"
+ class: Acme\HelloBundle\Newsletter\NewsletterManager
arguments: ["@?my_mailer"]
.. code-block:: xml
@@ -801,7 +762,7 @@ it exists and do nothing if it doesn't:
-
+
@@ -814,15 +775,9 @@ it exists and do nothing if it doesn't:
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\DependencyInjection\ContainerInterface;
- // ...
- $container->setParameter(
- 'newsletter_manager.class',
- 'Acme\HelloBundle\Newsletter\NewsletterManager'
- );
-
$container->setDefinition('my_mailer', ...);
$container->setDefinition('newsletter_manager', new Definition(
- '%newsletter_manager.class%',
+ 'Acme\HelloBundle\Newsletter\NewsletterManager',
array(
new Reference(
'my_mailer',
@@ -899,7 +854,7 @@ Configuring the service container is easy:
# src/Acme/HelloBundle/Resources/config/services.yml
services:
newsletter_manager:
- class: "%newsletter_manager.class%"
+ class: Acme\HelloBundle\Newsletter\NewsletterManager
arguments: ["@mailer", "@templating"]
.. code-block:: xml
@@ -910,7 +865,7 @@ Configuring the service container is easy:
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
-
+
@@ -920,7 +875,7 @@ Configuring the service container is easy:
// src/Acme/HelloBundle/Resources/config/services.php
$container->setDefinition('newsletter_manager', new Definition(
- '%newsletter_manager.class%',
+ 'Acme\HelloBundle\Newsletter\NewsletterManager',
array(
new Reference('mailer'),
new Reference('templating'),
diff --git a/components/dependency_injection/parameters.rst b/components/dependency_injection/parameters.rst
index 9b47e5141b9..8e76c4dd615 100644
--- a/components/dependency_injection/parameters.rst
+++ b/components/dependency_injection/parameters.rst
@@ -149,11 +149,10 @@ making the class of a service a parameter:
parameters:
mailer.transport: sendmail
- mailer.class: Mailer
services:
mailer:
- class: "%mailer.class%"
+ class: Mailer
arguments: ["%mailer.transport%"]
.. code-block:: xml
@@ -165,11 +164,10 @@ making the class of a service a parameter:
sendmail
- Mailer
-
+
%mailer.transport%
@@ -180,10 +178,9 @@ making the class of a service a parameter:
use Symfony\Component\DependencyInjection\Reference;
$container->setParameter('mailer.transport', 'sendmail');
- $container->setParameter('mailer.class', 'Mailer');
$container
- ->register('mailer', '%mailer.class%')
+ ->register('mailer', 'Mailer')
->addArgument('%mailer.transport%');
.. note::
diff --git a/components/dependency_injection/parentservices.rst b/components/dependency_injection/parentservices.rst
index 3158738fa15..b7729ab1f50 100644
--- a/components/dependency_injection/parentservices.rst
+++ b/components/dependency_injection/parentservices.rst
@@ -52,11 +52,6 @@ The service config for these classes would look something like this:
.. code-block:: yaml
- parameters:
- # ...
- newsletter_manager.class: NewsletterManager
- greeting_card_manager.class: GreetingCardManager
-
services:
my_mailer:
# ...
@@ -65,13 +60,13 @@ The service config for these classes would look something like this:
# ...
newsletter_manager:
- class: "%newsletter_manager.class%"
+ class: NewsletterManager
calls:
- [setMailer, ["@my_mailer"]]
- [setEmailFormatter, ["@my_email_formatter"]]
greeting_card_manager:
- class: "%greeting_card_manager.class%"
+ class: "GreetingCardManager"
calls:
- [setMailer, ["@my_mailer"]]
- [setEmailFormatter, ["@my_email_formatter"]]
@@ -83,12 +78,6 @@ The service config for these classes would look something like this:
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
-
-
- NewsletterManager
- GreetingCardManager
-
-
@@ -98,7 +87,7 @@ The service config for these classes would look something like this:
-
+
@@ -107,7 +96,7 @@ The service config for these classes would look something like this:
-
+
@@ -124,14 +113,11 @@ The service config for these classes would look something like this:
use Symfony\Component\DependencyInjection\Reference;
// ...
- $container->setParameter('newsletter_manager.class', 'NewsletterManager');
- $container->setParameter('greeting_card_manager.class', 'GreetingCardManager');
-
$container->register('my_mailer', ...);
$container->register('my_email_formatter', ...);
$container
- ->register('newsletter_manager', '%newsletter_manager.class%')
+ ->register('newsletter_manager', 'NewsletterManager')
->addMethodCall('setMailer', array(
new Reference('my_mailer'),
))
@@ -141,7 +127,7 @@ The service config for these classes would look something like this:
;
$container
- ->register('greeting_card_manager', '%greeting_card_manager.class%')
+ ->register('greeting_card_manager', 'GreetingCardManager')
->addMethodCall('setMailer', array(
new Reference('my_mailer'),
))
@@ -208,11 +194,11 @@ a parent for a service.
- [setEmailFormatter, ["@my_email_formatter"]]
newsletter_manager:
- class: "%newsletter_manager.class%"
+ class: "NewsletterManager"
parent: mail_manager
greeting_card_manager:
- class: "%greeting_card_manager.class%"
+ class: "GreetingCardManager"
parent: mail_manager
.. code-block:: xml
@@ -237,12 +223,12 @@ a parent for a service.
@@ -267,11 +253,11 @@ a parent for a service.
$container->setDefinition('mail_manager', $mailManager);
$newsletterManager = new DefinitionDecorator('mail_manager');
- $newsletterManager->setClass('%newsletter_manager.class%');
+ $newsletterManager->setClass('NewsletterManager');
$container->setDefinition('newsletter_manager', $newsletterManager);
$greetingCardManager = new DefinitionDecorator('mail_manager');
- $greetingCardManager->setClass('%greeting_card_manager.class%');
+ $greetingCardManager->setClass('GreetingCardManager');
$container->setDefinition('greeting_card_manager', $greetingCardManager);
In this context, having a ``parent`` service implies that the arguments and
@@ -336,13 +322,13 @@ to the ``NewsletterManager`` class, the config would look like this:
- [setEmailFormatter, ["@my_email_formatter"]]
newsletter_manager:
- class: "%newsletter_manager.class%"
+ class: "NewsletterManager"
parent: mail_manager
calls:
- [setMailer, ["@my_alternative_mailer"]]
greeting_card_manager:
- class: "%greeting_card_manager.class%"
+ class: "GreetingCardManager"
parent: mail_manager
.. code-block:: xml
@@ -371,7 +357,7 @@ to the ``NewsletterManager`` class, the config would look like this:
@@ -381,7 +367,7 @@ to the ``NewsletterManager`` class, the config would look like this:
@@ -408,7 +394,7 @@ to the ``NewsletterManager`` class, the config would look like this:
$container->setDefinition('mail_manager', $mailManager);
$newsletterManager = new DefinitionDecorator('mail_manager');
- $newsletterManager->setClass('%newsletter_manager.class%');
+ $newsletterManager->setClass('NewsletterManager');
->addMethodCall('setMailer', array(
new Reference('my_alternative_mailer'),
))
@@ -416,7 +402,7 @@ to the ``NewsletterManager`` class, the config would look like this:
$container->setDefinition('newsletter_manager', $newsletterManager);
$greetingCardManager = new DefinitionDecorator('mail_manager');
- $greetingCardManager->setClass('%greeting_card_manager.class%');
+ $greetingCardManager->setClass('GreetingCardManager');
$container->setDefinition('greeting_card_manager', $greetingCardManager);
The ``GreetingCardManager`` will receive the same dependencies as before,
diff --git a/components/dependency_injection/tags.rst b/components/dependency_injection/tags.rst
index 1c4e08590e4..b8442c3b933 100644
--- a/components/dependency_injection/tags.rst
+++ b/components/dependency_injection/tags.rst
@@ -39,12 +39,9 @@ Then, define the chain as a service:
.. code-block:: yaml
- parameters:
- acme_mailer.transport_chain.class: TransportChain
-
services:
acme_mailer.transport_chain:
- class: "%acme_mailer.transport_chain.class%"
+ class: TransportChain
.. code-block:: xml
@@ -53,12 +50,8 @@ Then, define the chain as a service:
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
-
- TransportChain
-
-
-
+
@@ -66,9 +59,7 @@ Then, define the chain as a service:
use Symfony\Component\DependencyInjection\Definition;
- $container->setParameter('acme_mailer.transport_chain.class', 'TransportChain');
-
- $container->setDefinition('acme_mailer.transport_chain', new Definition('%acme_mailer.transport_chain.class%'));
+ $container->setDefinition('acme_mailer.transport_chain', new Definition('TransportChain'));
Define Services with a custom Tag
---------------------------------
diff --git a/cookbook/console/logging.rst b/cookbook/console/logging.rst
index 61f54d3583c..031121051f1 100644
--- a/cookbook/console/logging.rst
+++ b/cookbook/console/logging.rst
@@ -98,12 +98,8 @@ First configure a listener for console exception events in the service container
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
-
- Acme\DemoBundle\EventListener\ConsoleExceptionListener
-
-
-
+
@@ -116,12 +112,8 @@ First configure a listener for console exception events in the service container
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Reference;
- $container->setParameter(
- 'console_exception_listener.class',
- 'Acme\DemoBundle\EventListener\ConsoleExceptionListener'
- );
$definitionConsoleExceptionListener = new Definition(
- '%console_exception_listener.class%',
+ 'Acme\DemoBundle\EventListener\ConsoleExceptionListener',
array(new Reference('logger'))
);
$definitionConsoleExceptionListener->addTag(
diff --git a/cookbook/controller/service.rst b/cookbook/controller/service.rst
index f0d23943579..bf2cadb2887 100644
--- a/cookbook/controller/service.rst
+++ b/cookbook/controller/service.rst
@@ -54,24 +54,15 @@ Then you can define it as a service as follows:
.. code-block:: yaml
# src/Acme/HelloBundle/Resources/config/services.yml
- parameters:
- # ...
- acme.controller.hello.class: Acme\HelloBundle\Controller\HelloController
-
services:
acme.hello.controller:
- class: "%acme.controller.hello.class%"
+ class: Acme\HelloBundle\Controller\HelloController
.. code-block:: xml
-
-
- Acme\HelloBundle\Controller\HelloController
-
-
-
+
.. code-block:: php
@@ -79,14 +70,8 @@ Then you can define it as a service as follows:
// src/Acme/HelloBundle/Resources/config/services.php
use Symfony\Component\DependencyInjection\Definition;
- // ...
- $container->setParameter(
- 'acme.controller.hello.class',
- 'Acme\HelloBundle\Controller\HelloController'
- );
-
$container->setDefinition('acme.hello.controller', new Definition(
- '%acme.controller.hello.class%'
+ 'Acme\HelloBundle\Controller\HelloController'
));
Referring to the Service
@@ -208,27 +193,16 @@ argument:
.. code-block:: yaml
# src/Acme/HelloBundle/Resources/config/services.yml
- parameters:
- # ...
- acme.controller.hello.class: Acme\HelloBundle\Controller\HelloController
-
services:
acme.hello.controller:
- class: "%acme.controller.hello.class%"
+ class: Acme\HelloBundle\Controller\HelloController
arguments: ["@templating"]
.. code-block:: xml
-
-
- Acme\HelloBundle\Controller\HelloController
-
-
-
+
@@ -239,14 +213,8 @@ argument:
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Reference;
- // ...
- $container->setParameter(
- 'acme.controller.hello.class',
- 'Acme\HelloBundle\Controller\HelloController'
- );
-
$container->setDefinition('acme.hello.controller', new Definition(
- '%acme.controller.hello.class%',
+ 'Acme\HelloBundle\Controller\HelloController',
array(new Reference('templating'))
));
diff --git a/cookbook/profiler/matchers.rst b/cookbook/profiler/matchers.rst
index b23af0d21f0..064e8fdd1b7 100644
--- a/cookbook/profiler/matchers.rst
+++ b/cookbook/profiler/matchers.rst
@@ -95,25 +95,16 @@ Then, you need to configure the service:
.. code-block:: yaml
- parameters:
- acme_demo.profiler.matcher.super_admin.class: Acme\DemoBundle\Profiler\SuperAdminMatcher
-
services:
acme_demo.profiler.matcher.super_admin:
- class: "%acme_demo.profiler.matcher.super_admin.class%"
+ class: Acme\DemoBundle\Profiler\SuperAdminMatcher
arguments: ["@security.context"]
.. code-block:: xml
-
- Acme\DemoBundle\Profiler\SuperAdminMatcher
-
-
+ class="Acme\DemoBundle\Profiler\SuperAdminMatcher">
@@ -122,13 +113,8 @@ Then, you need to configure the service:
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Reference;
- $container->setParameter(
- 'acme_demo.profiler.matcher.super_admin.class',
- 'Acme\DemoBundle\Profiler\SuperAdminMatcher'
- );
-
$container->setDefinition('acme_demo.profiler.matcher.super_admin', new Definition(
- '%acme_demo.profiler.matcher.super_admin.class%',
+ 'Acme\DemoBundle\Profiler\SuperAdminMatcher',
array(new Reference('security.context'))
);
diff --git a/cookbook/security/custom_provider.rst b/cookbook/security/custom_provider.rst
index 180a6feb119..5ba3ac7c986 100644
--- a/cookbook/security/custom_provider.rst
+++ b/cookbook/security/custom_provider.rst
@@ -176,22 +176,15 @@ Now you make the user provider available as a service:
.. code-block:: yaml
# src/Acme/WebserviceUserBundle/Resources/config/services.yml
- parameters:
- webservice_user_provider.class: Acme\WebserviceUserBundle\Security\User\WebserviceUserProvider
-
services:
webservice_user_provider:
- class: "%webservice_user_provider.class%"
+ class: Acme\WebserviceUserBundle\Security\User\WebserviceUserProvider
.. code-block:: xml
-
- Acme\WebserviceUserBundle\Security\User\WebserviceUserProvider
-
-
-
+
.. code-block:: php
@@ -199,9 +192,10 @@ Now you make the user provider available as a service:
// src/Acme/WebserviceUserBundle/Resources/config/services.php
use Symfony\Component\DependencyInjection\Definition;
- $container->setParameter('webservice_user_provider.class', 'Acme\WebserviceUserBundle\Security\User\WebserviceUserProvider');
-
- $container->setDefinition('webservice_user_provider', new Definition('%webservice_user_provider.class%');
+ $container->setDefinition(
+ 'webservice_user_provider',
+ new Definition('Acme\WebserviceUserBundle\Security\User\WebserviceUserProvider')
+ );
.. tip::
diff --git a/cookbook/security/securing_services.rst b/cookbook/security/securing_services.rst
index 641a43f04ec..3fc3ef16197 100644
--- a/cookbook/security/securing_services.rst
+++ b/cookbook/security/securing_services.rst
@@ -74,23 +74,16 @@ Then in your service configuration, you can inject the service:
.. code-block:: yaml
# src/Acme/HelloBundle/Resources/config/services.yml
- parameters:
- newsletter_manager.class: Acme\HelloBundle\Newsletter\NewsletterManager
-
services:
newsletter_manager:
- class: "%newsletter_manager.class%"
+ class: Acme\HelloBundle\Newsletter\NewsletterManager
arguments: ["@security.context"]
.. code-block:: xml
-
- Acme\HelloBundle\Newsletter\NewsletterManager
-
-
-
+
@@ -101,10 +94,8 @@ Then in your service configuration, you can inject the service:
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Reference;
- $container->setParameter('newsletter_manager.class', 'Acme\HelloBundle\Newsletter\NewsletterManager');
-
$container->setDefinition('newsletter_manager', new Definition(
- '%newsletter_manager.class%',
+ 'Acme\HelloBundle\Newsletter\NewsletterManager',
array(new Reference('security.context'))
));
@@ -172,7 +163,7 @@ the :ref:`sidebar ` below):
-
+
@@ -185,7 +176,7 @@ the :ref:`sidebar ` below):
use Symfony\Component\DependencyInjection\Reference;
$definition = new Definition(
- '%newsletter_manager.class%',
+ 'Acme\HelloBundle\Newsletter\NewsletterManager',
array(new Reference('security.context'))
));
$definition->addTag('security.secure_service');
diff --git a/cookbook/service_container/scopes.rst b/cookbook/service_container/scopes.rst
index 786de8a93e2..70ad093561e 100644
--- a/cookbook/service_container/scopes.rst
+++ b/cookbook/service_container/scopes.rst
@@ -301,26 +301,17 @@ The service config for this class would look something like this:
.. code-block:: yaml
# src/Acme/HelloBundle/Resources/config/services.yml
- parameters:
- # ...
- my_mailer.class: Acme\HelloBundle\Mail\Mailer
-
services:
my_mailer:
- class: "%my_mailer.class%"
+ class: Acme\HelloBundle\Mail\Mailer
arguments: ["@service_container"]
# scope: container can be omitted as it is the default
.. code-block:: xml
-
-
- Acme\HelloBundle\Mail\Mailer
-
-
-
+
@@ -331,11 +322,8 @@ The service config for this class would look something like this:
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Reference;
- // ...
- $container->setParameter('my_mailer.class', 'Acme\HelloBundle\Mail\Mailer');
-
$container->setDefinition('my_mailer', new Definition(
- '%my_mailer.class%',
+ 'Acme\HelloBundle\Mail\Mailer',
array(new Reference('service_container'))
));