Is there a way to inject a bundle into a service?
I would like to write my service constructor like this:
<?php
use Symfony\Component\HttpKernel\Bundle\Bundle;
class MyService
{
/** @var Bundle */
private $bundle;
public function __construct(Bundle $bundle)
{
$this->bundle = $bundle;
}
}
For the services.yml I’d like to have something like this:
services:
my_service:
class: MyService
arguments: ['how_can_i_reference_a_bundle']
Your bundle can be setup as a service like that: