2014-03-03 107 views
1

我如何轉換到這個ymlXML來YAML轉換

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

現在我走了這麼遠的轉換:

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

<argument type = "collection">是我stucked與線。謝謝。

+4

您可以用[Symfony2的服務配置器]會自動轉換成現在這個(http://converter.rosstuck.com/)。 – RelaXNow

回答

5

嘗試:

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

+2

你已經擊中了!謝謝..我是YAML的新手,你的回答給了我未來申請的提示......這對我有很大的幫助... – Cedric