1
1
1alexandr2015-01-10 16:45:50
symfony
1alexandr, 2015-01-10 16:45:50

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

2 answer(s)
R
Ruslan Kvashnin, 2015-01-10
@RussellKvashnin

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"]]

S
Sergey, 2015-01-10
Protko @Fesor

mailer service. Inject it. If there is no such service, then it's a problem. This service is located in symfony/SwiftmailerBundle

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question