Answer the question
In order to leave comments, you need to log in
How to properly use Di container component symfony?
For some reason, Di container does not work, did I implement it correctly?
bootstrap.php
$container = new ContainerBuilder();
$loader = new DiYamlFileLoader($container, new FileLocator(__DIR__));
$loader->load('../config/services.yaml');
$container->compile();
services:
_defaults:
autowire: true
autoconfigure: true
public: false
App\:
resource: ../app/
exclude: ../app/[a-z]*
dependent.service:
class: 'App\Interfaces\Services\ReportServiceInterface''
demo.service:
class: 'App\Generators\ReportGenerator'
arguments: ['@dependent.service']
public function __construct(ReportServiceInterface $reportService)
{
$this->reportService = $reportService;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question