Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
fetchChildren example
}
if
(
$idsWithChangedParentIds
!==
[
]
)
{
$this
->treeUpdater->
batchUpdate
(
$idsWithChangedParentIds
,
MediaFolderDefinition::ENTITY_NAME,
$event
->
getContext
(
)
)
;
}
$updates
=
array_values
(
array_merge
(
$updates
,
$this
->
fetchChildren
(
$updates
)
,
$this
->
getParentIds
(
$updates
)
)
)
;
return
new
MediaIndexingMessage
(
$updates
, null,
$event
->
getContext
(
)
)
;
}
public
function
handle
(
EntityIndexingMessage
$message
)
: void
{
$context
=
$message
->
getContext
(
)
;
$ids
=
$message
->
getData
(
)
;
$ids
=
array_filter
(
array_unique
(
$ids
)
)
;
return
null;
}
if
(
$idsWithChangedParentIds
!==
[
]
)
{
$this
->treeUpdater->
batchUpdate
(
$idsWithChangedParentIds
,
CategoryDefinition::ENTITY_NAME,
$event
->
getContext
(
)
)
;
}
$children
=
$this
->
fetchChildren
(
$ids
,
$event
->
getContext
(
)
->
getVersionId
(
)
)
;
$ids
=
array_unique
(
array_merge
(
$ids
,
$children
)
)
;
return
new
CategoryIndexingMessage
(
array_values
(
$ids
)
, null,
$event
->
getContext
(
)
, \
count
(
$ids
)
> 20
)
;
}
public
function
handle
(
EntityIndexingMessage
$message
)
: void
{
$ids
=
$message
->
getData
(
)
;
/** @var list<string> $ids */