Skip to content
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
6 changes: 4 additions & 2 deletions service_container/service_decoration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -146,15 +146,17 @@ automatically changed to ``'.inner'``):
namespace App;

// ...
use App\Mailer;
use Symfony\Component\DependencyInjection\Attribute\AsDecorator;
use Symfony\Component\DependencyInjection\Attribute\AutowireDecorated;

#[AsDecorator(decorates: Mailer::class)]
class DecoratingMailer
{
public function __construct(
#[AutowireDecorated]
private object $inner,
// unlike other configuration formats, that name the decorated service argument
// as `$inner` by default, when using attributes you can choose any variable name
#[AutowireDecorated] private Mailer $mailer,
) {
}

Expand Down