有没有办法将捆绑包注入服务?
我想像这样编写我的服务构造函数:
<?php
use Symfony\Component\HttpKernel\Bundle\Bundle;
class MyService
{
/** @var Bundle */
private $bundle;
public function __construct(Bundle $bundle)
{
$this->bundle = $bundle;
}
}
对于services.yml
我想要这样的东西:
services:
my_service:
class: MyService
arguments: ['how_can_i_reference_a_bundle']