I have the following set of settings in my factory.yml file ...
all: mailer: param: transport: class: Swift_SendmailTransport param: command: /usr/sbin/sendmail -oi -t
... to overcome the double point problem as described here .
When I run the following code ...
$mailer = $this->getMailer(); $message = $mailer->compose(); $message->setTo(' foo@bar.com '); $message->setFrom(' foo@bar.com '); $message->setSubject('Testing'); $message->setBody( $mailer->getRealtimeTransport()->getCommand(), 'text/plain' ); $mailer->send($message);
... inside the action, everything works as expected. But when I run the same code from within the task, I get a fatal error - PHP Fatal error: Call to undefined method getCommand - because SwiftMailer uses the default transport class and not the Swift_SendmailTransport class, as specified in the factories.yml configuration.
Any ideas why the factory.yml configuration is not loading into the symfony task and how can I solve this problem?
source share