Domanda

How can I convert this into 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.

È stato utile?

Soluzione

Try:

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% } }

Check this: http://symfony.com/doc/current/components/yaml/yaml_format.html#collections

Altri suggerimenti

There is a neat and simple online tool for converting Symfony XML config to YAML.

Symfony2 Service Config Converter

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top