Answer the question
In order to leave comments, you need to log in
symfony2. Where is the Mailer class?
Actually a subject. You need to fire it in the controller. Legs grow from here https://toster.ru/q/172209?utm_source=email_toster...
I ask for your help, dear experts!
problem solved. It was necessary to inject the container using a setter, an example in the answers
Answer the question
In order to leave comments, you need to log in
You all perfectly told in the previous thread.
If it's not clear, I'll try to summarize.
It is not necessary to inject the mailer service into the controller, because the controller in symphony implements ContainerAwareInterface and the service can be accessed using the get() method.
If for some reason your controller does not inherit from the standard symphony controller, you must implement ContainerAwareInterface.
If you inherit the standard symphony controller, and make your controller a service, you must inject the container using a setter.
Configuration example:
my.controller.service:
class: MyCompany\MyBundle\Controller\MyController
calls:
- [setContainer, ["@service_container"]]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question