Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
createIndices example
/** @var array<string> $entities */
$entities
=
array_keys
(
$this
->indexer
)
;
if
(
$indexingBehavior
->
getOnlyEntities
(
)
)
{
$entities
=
array_intersect
(
$entities
,
$indexingBehavior
->
getOnlyEntities
(
)
)
;
}
elseif
(
$indexingBehavior
->
getSkipEntities
(
)
)
{
$entities
=
array_diff
(
$entities
,
$indexingBehavior
->
getSkipEntities
(
)
)
;
}
$indices
=
$this
->
createIndices
(
$entities
)
;
foreach
(
$entities
as
$entityName
)
{
$indexer
=
$this
->
getIndexer
(
$entityName
)
;
$iterator
=
$indexer
->
getIterator
(
)
;
$this
->dispatcher->
dispatch
(
new
ProgressStartedEvent
(
$indexer
->
getName
(
)
,
$iterator
->
fetchCount
(
)
)
)
;
while
(
$ids
=
$iterator
->
fetch
(
)
)
{
$ids
=
array_values
(
$ids
)
;
// we provide no queue when the data is sent by the admin