symfony xml配置重复的数组节点

时间:2018-02-07 11:36:06

标签: xml symfony configuration components

我正在尝试使用Symfony配置组件解析和验证xml配置文件。

配置文件如下所示:

`<?xml version="1.0" encoding="utf-8"?>
    <root>
        <description>description</description>
        <rows>
            <row name="name">
                <type>text_validated</type>
                <label>Name</label>
                <font>opensans</font>
                <fontSize>9</fontSize>
                <maxLength>95</maxLength>
                <editable>false</editable>
            </row>
            <row name="name2">
                <type>text_validated</type>
                <label>Name 2</label>
                <font>opensans</font>
                <fontSize>9</fontSize>
                <maxLength>95</maxLength>
                <editable>false</editable>
            </row>
        </rows>
    </root>`

具有任意数量的标签(1个或多于1个)。 我希望得到如下结果:

array:2 [
    "description" => "description"
    "rows" => array:2 [
        "name" => array:6 [
            "type" => "text_validated"
            "label" => "Nome Hotel"
            "font" => "opensans"
            "fontSize" => 9
            "maxLength" => 95
            "editable" => false
        ]
        "name2" => array:6 [
            "type" => "text_validated"
            "label" => "Nome Hotel2"
            "font" => "opensans"
            "fontSize" => 9
            "maxLength" => 95
            "editable" => false
        ]
    ]
]

是否可以使用Symfony配置组件?

0 个答案:

没有答案