Symfony~2.4作曲家更新swiftmailer.mailer.default.transport.real依赖性异常

时间:2014-04-03 11:48:14

标签: symfony composer-php swiftmailer

作曲家更新后,我开始收到错误消息:

服务" swiftmailer.mailer.default.transport.real"依赖于不存在的服务" swiftmailer.transport.buffer"

经过一番研究后我找到了解决方案:

基本上他们提供的是设置swiftmail参数spool: {type: memory}或手动创建服务描述

我已经为所有配置添加了sppol:config.yml,config_test.yml,config_dev.yml但是没有帮助。然后我在我的一个包services.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

有任何建议如何解决这个问题?

3 个答案:

答案 0 :(得分:1)

试试我的变体,它适用于我:

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]

答案 1 :(得分:0)

尝试在service.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]

我使用了上一个答案的一部分并进行了操作。希望这对你有用

答案 2 :(得分:0)

@Yury Pliashkou's版本回答:

<?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>