You are a developer and looking for Shopware projects?
Apply Now!
updateTree example
if
(
$parent
===
[
]
)
{
return
[
]
;
}
return
$this
->
updateRecursive
(
$parent
,
$definition
,
$context
)
;
}
private
function
updateRecursive
(
array
$entity
, EntityDefinition
$definition
, Context
$context
)
: array
{
$ids
=
[
]
;
$ids
[
]
=
$this
->
updateTree
(
$entity
,
$definition
,
$context
)
;
foreach
(
$this
->
getChildren
(
$entity
,
$definition
,
$context
)
as
$child
)
{
$child
[
'parent'
]
=
$entity
;
$child
[
'parentCount'
]
=
$entity
[
'parentCount'
]
+ 1;
$ids
=
array_merge
(
$ids
,
$this
->
updateRecursive
(
$child
,
$definition
,
$context
)
)
;
}
return
$ids
;
}
private
function
getChildren
(
array
$parent
, EntityDefinition
$definition
, Context
$context
)
: array
{