Skip to content

Commit

Permalink
language tweak for the tip introduced in #3743
Browse files Browse the repository at this point in the history
  • Loading branch information
xabbuh committed Apr 12, 2014
1 parent dda9e88 commit deb5d71
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions components/dependency_injection/parentservices.rst
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ a parent for a service.
use Symfony\Component\DependencyInjection\Reference;
// ...
$mailManager = new Definition();
$mailManager
->setAbstract(true);
Expand All @@ -254,11 +254,11 @@ a parent for a service.
))
;
$container->setDefinition('mail_manager', $mailManager);
$newsletterManager = new DefinitionDecorator('mail_manager');
$newsletterManager->setClass('%newsletter_manager.class%');
$container->setDefinition('newsletter_manager', $newsletterManager);
$greetingCardManager = new DefinitionDecorator('mail_manager');
$greetingCardManager->setClass('%greeting_card_manager.class%');
$container->setDefinition('greeting_card_manager', $greetingCardManager);
Expand Down Expand Up @@ -291,13 +291,13 @@ would cause an exception to be raised for a non-abstract service.
In order for parent dependencies to resolve, the ``ContainerBuilder`` must
first be compiled. See :doc:`/components/dependency_injection/compilation`
for more details.

.. tip::

In the examples shown, the classes sharing the same configuration also extend
from the same parent in PHP. This does not need to be the case though, you can
extract common parts of similar service definitions into a parent service without
also extending a parent class in PHP.
In the examples shown, the classes sharing the same configuration also
extend from the same parent class in PHP. This isn't necessary at all.
You can just extract common parts of similar service definitions into
a parent service without also extending a parent class in PHP.

Overriding Parent Dependencies
------------------------------
Expand Down Expand Up @@ -377,7 +377,7 @@ to the ``NewsletterManager`` class, the config would look like this:
// ...
$container->setDefinition('my_alternative_mailer', ...);
$mailManager = new Definition();
$mailManager
->setAbstract(true);
Expand Down

0 comments on commit deb5d71

Please sign in to comment.