XML 到 YAML 的转换 [英] XML to YAML convert

查看:221
本文介绍了XML 到 YAML 的转换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将其转换为 yml:

    <service id="fos_user.mailer.twig_swift" class="FOS\UserBundle\Mailer\TwigSwiftMailer" public="false">
        <argument type="service" id="mailer" />
        <argument type="service" id="router" />
        <argument type="service" id="twig" />
        <argument type="collection">
            <argument key="template" type="collection">
                <argument key="confirmation">%fos_user.registration.confirmation.template%</argument>
                <argument key="resetting">%fos_user.resetting.email.template%</argument>
            </argument>
            <argument key="from_email" type="collection">
                <argument key="confirmation">%fos_user.registration.confirmation.from_email%</argument>
                <argument key="resetting">%fos_user.resetting.email.from_email%</argument>
            </argument>
        </argument>
    </service>

现在我已经完成了这么远的转换:

now I've got this far in converting:

fos_user.mailer.twig_swiftr:
    class: FOS\UserBundle\Mailer\TwigSwiftMailer
    arguments: ['@mailer', '@router', '@twig']

这个 是我坚持的那一行.谢谢.

this <argument type = "collection"> is the line I am stucked with. Thanks.

推荐答案

尝试:

fos_user.mailer.twig_swiftr:
    class: FOS\UserBundle\Mailer\TwigSwiftMailer
    arguments:
        - @mailer
        - @router
        - @twig
        - { template: { confirmation: %fos_user.registration.confirmation.template%, resetting: %fos_user.resetting.email.template% }, from_email: { confirmation: %fos_user.registration.confirmation.from_email%, resetting: %fos_user.resetting.email.from_email% } }

检查这个:http://symfony.com/doc/current/components/yaml/yaml_format.html#collections

这篇关于XML 到 YAML 的转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆