Skip to content

[DependencyInjection] Fix decorating service definition #7911

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 18, 2017
Merged
Changes from all 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
16 changes: 10 additions & 6 deletions service_container/service_decoration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ a reference of the old one as ``app.decorating_mailer.inner``:
# ...

app.decorating_mailer:
class: AppBundle\DecoratingMailer
decorates: app.mailer
arguments: ['@app.decorating_mailer.inner']
public: false
class: AppBundle\DecoratingMailer
decorates: app.mailer
arguments: ['@app.decorating_mailer.inner']
public: false

.. code-block:: xml

Expand Down Expand Up @@ -130,7 +130,7 @@ convention, the old ``app.mailer`` service is renamed to
.. code-block:: yaml

services:
app.mailer:
app.decorating_mailer:
# ...
decoration_inner_name: app.decorating_mailer.wooz
arguments: ['@app.decorating_mailer.wooz']
Expand All @@ -146,7 +146,11 @@ convention, the old ``app.mailer`` service is renamed to
<!-- ... -->

<service
id="app.decorating_mailer"
class="AppBundle\DecoratingMailer"
decorates="app.mailer"
decoration-inner-name="app.decorating_mailer.wooz"
public="false"
>
<argument type="service" id="app.decorating_mailer.wooz" />
</service>
Expand All @@ -160,7 +164,7 @@ convention, the old ``app.mailer`` service is renamed to
use Symfony\Component\DependencyInjection\Reference;

$container->register('app.decorating_mailer', DecoratingMailer::class)
->setDecoratedService('foo', 'app.decorating_mailer.wooz')
->setDecoratedService('app.mailer', 'app.decorating_mailer.wooz')
->addArgument(new Reference('app.decorating_mailer.wooz'))
// ...
;
Expand Down