So when I first encountered this issue with Symfony I was baffled. Why can you auto-wire Symfony Controller methods but with Services (aka your other classes under src) why do you have to auto-wire only the constructor. I couldn’t figure out why I couldn’t auto-wire to the methods instead.
Well, while working on deciding how I wanted to handle errors and exceptions, I googled something that lead me to the explanation. I Found in this Symfonycast deep dive right here.
I won’t repeat it all, go read it. LOL. I am sure this is stated somewhere in the docs or something, but read this explanation.
I’d suggest reading the entire Symfonycast or purchase the subscription to watch the animated videos. That cast is one of the best if you want to understand how the Request/Response life cycle actually works in Symfony.I’ve been reading it and playing around and it is all finally making sense now.

Basically it is how the argument resolver system works. Now I finally understand and it makes sense.
Comments
You must log in to post a comment.