如何将此文件转换为yml?

时间:2012-02-18 12:55:08

标签: xml symfony yaml

如何将此文件转换为yml?

<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="sonata.admin.course" class="YourNS\AdminBundle\Admin\BlogAdmin">
              <tag name="sonata.admin" manager_type="orm" group="Posts" label="Blog"/>
              <argument />
              <argument>YourNS\AdminBundle\Entity\Course</argument>
              <argument>SonataAdminBundle:CRUD</argument>
              <call method="setTranslationDomain">
                  <argument>YourNSAdminBundle</argument>
              </call>
          </service>
       </services>
    </container>

2 个答案:

答案 0 :(得分:8)

像这样(我没有测试过):

services:
  sonata.admin.course:
    class: YourNS\AdminBundle\Admin\BlogAdmin
    arguments: [null, YourNS\AdminBundle\Entity\Course, 'SonataAdminBundle:CRUD']
    calls:
        - [setTranslationDomain, YourNSAdminBundle]
    tags:
        - { name: sonata.admin, manager_type: orm, group: Posts, label: Blog }

答案 1 :(得分:5)

你忘了括号[YourNSAdminBundle]:

services:
  sonata.admin.course:
    class: YourNS\AdminBundle\Admin\BlogAdmin
    arguments: [null, YourNS\AdminBundle\Entity\Course, 'SonataAdminBundle:CRUD']
    calls:
      - [setTranslationDomain, [YourNSAdminBundle]]
    tags:
      - { name: sonata.admin, manager_type: orm, group: Posts, label: Blog }