Answer the question
In order to leave comments, you need to log in
How does symfony load classes via input?
For example:
public function createProduct(ValidatorInterface $validator): Response
{
...
}
Answer the question
In order to leave comments, you need to log in
There is a good deal of documentation on this for the Dependency Injection component and the Service Container , which is the central part of this component.
In short, you either describe services manually via configuration (there are several supported formats, including annotations, although they seem to be implemented by an external package) or take advantage of autowiring 'a, leaving Symfony to describe everything for you (using compiler passes , if would need). Actually, the main "magic" of converting all data sources into a bunch of compiled PHP is just in the compiler passes, there are a lot of them and you can write your own.
Since in your example - controller's action - here all the magic is implemented through the processing of the tag controller.service_arguments
, which by default is added to all controllers in the services config.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question