我有一个具有父子关系的分层数组。现在,当我尝试转换它时,转换只发生在一个层面上。我的数组如下所示:
Array
(
[0] => stdClass Object
(
[id] => 4
[parent_uuid] =>
[name] => Users
[placement] => 1
[children] => Array
(
[0] => stdClass Object
(
[id] => 1
[parent_uuid] => 4
[name] => User Profile
[placement] => 1
[children] => Array
(
[2] => stdClass Object
(
[id] => 7
[parent_uuid] => 1
[name] => Test Page
[placement] => 1
)
)
)
)
)
)我使用的是分形变换,但问题是在变换之后,我只得到了第一个子对象,因为变换不会查看嵌套数组。如何让转换器查看嵌套数组?
发布于 2017-08-21 19:14:45
这可以通过使用默认包含来实现。我们需要在第一个树转换器中让孩子作为default includes,也应该在孩子转换器中做同样的事情。
https://stackoverflow.com/questions/45717048
复制相似问题