作曲家更新后,我开始收到错误消息:
服务"swiftmailer.mailer.default.transport.real"依赖于不存在的服务"swiftmailer.transport.buffer"
经过一些研究,我找到了解决方案:
- http://error.bengtuo.com/page/13489.html
- Symfony2 Monolog to Email Errors 為什麼 swiftmailer.transport.real 是不存在的服務
基本上他们提供的是设置swiftmail参数spool: {type: memory}
或手动创建服务描述
我已经将sppol添加到所有配置中:config.yml,config_test.yml,config_dev.yml,但这没有帮助。然后我在我的一个捆绑包服务中添加了条目.yml
swiftmailer.transport.simplemailinvoker:
class: Swift_Transport_SimpleMailInvoker
swiftmailer.transport.eventdispatcher:
class: Swift_Events_SimpleEventDispatcher
swiftmailer.transport.real:
class: Swift_Transport_MailTransport
arguments: [@swiftmailer.transport.simplemailinvoker, @swiftmailer.transport.eventdispatcher]
但这并没有解决我的问题。
我的作曲家文件如下所示:
http://pastebin.com/Wsfx22Lg
有什么建议如何解决这个问题吗?
试试我的变体,它对我有用:
swiftmailer.transport.simplemailinvoker:
class: Swift_Transport_SimpleMailInvoker
swiftmailer.transport.eventdispatcher:
class: Swift_Events_SimpleEventDispatcher
swiftmailer.replacementfactory:
class: Swift_StreamFilters_StringReplacementFilterFactory
swiftmailer.transport.buffer:
class: Swift_Transport_StreamBuffer
arguments: [@swiftmailer.replacementfactory]
swiftmailer.transport.real:
class: Swift_Transport_MailTransport
arguments: [@swiftmailer.transport.simplemailinvoker, @swiftmailer.transport.eventdispatcher]
服务中添加此内容.yml:为我工作
swiftmailer.transport.simplemailinvoker:
class: Swift_Transport_SimpleMailInvoker
swiftmailer.transport.eventdispatcher:
class: Swift_Events_SimpleEventDispatcher
swiftmailer.transport.buffer:
class: Swift_Transport_StreamBuffer
swiftmailer.transport.real:
class: Swift_Transport_MailTransport
arguments: [@swiftmailer.transport.simplemailinvoker, @swiftmailer.transport.eventdispatcher]
我使用了之前答案的一部分并对其进行了处理。希望这对你有用
@Yury Pliashkou的回答的xml版本:
<?xml version="1.0" encoding="UTF-8"?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<service id="swiftmailer.transport.simplemailinvoker" class="Swift_Transport_SimpleMailInvoker" />
<service id="swiftmailer.transport.eventdispatcher" class="Swift_Events_SimpleEventDispatcher" />
<service id="swiftmailer.replacementfactory" class="Swift_StreamFilters_StringReplacementFilterFactory" />
<service id="swiftmailer.transport.buffer" class="Swift_Transport_StreamBuffer">
<argument type="service" id="swiftmailer.replacementfactory"></argument>
</service>
<service id="swiftmailer.transport.real" class="Swift_Transport_MailTransport">
<argument type="service" id="swiftmailer.transport.simplemailinvoker"></argument>
<argument type="service" id="swiftmailer.transport.eventdispatcher"></argument>
</service>
</services>
</container>