"Avoiding your Code Becoming Dependent on the Container¶
Whilst you can retrieve services from the container directly it is best to minimize this. For example, in the NewsletterManager you injected the mailer service in rather than asking for it from the container. You could have injected the container in and retrieved the mailer service from it but it would then be tied to this particular container making it difficult to reuse the class elsewhere.
You will need to get a service from the container at some point but this should be as few times as possible at the entry point to your applica…