Reputation: 625
I am trying to inject the RequestStack into my reusable bundle in Symfony 5:
use Symfony\Component\HttpFoundation\RequestStack;
class ICatcherSeo extends Bundle
{
function __construct(RequestStack $requestStack) {
$RequestStack = $requestStack;
}
My services.yaml:
App\ICatcher\Seo\:
resource: '../bundles/ICatcher/Seo/*'
autowire: true
This throws an error:
Too few arguments to function App\ICatcher\Seo\ICatcherSeo::__construct(), 0 passed in D:\SERVER-7_2\htdocs\compasswebdesign\vendor\symfony\framework-bundle\Kernel\MicroKernelTrait.php on line 74 and exactly 1 expected
Upvotes: 0
Views: 393
Reputation: 1022
You are not supposed to inject anything into the bundle since the code of your bundle shouldn't be there (only some specific action and configuration).
The code of your bundle, just like the code of a project should be in controllers, listeners, services, depending on what is your goal.
Upvotes: 1