Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
refreshIndices example
$this
->
swapAlias
(
$indices
)
;
}
public
function
refresh
(
EntityWrittenContainerEvent
$event
)
: void
{
if
(
!
$this
->adminEsHelper->
getEnabled
(
)
|| !
$this
->
isIndexedEntityWritten
(
$event
)
)
{
return
;
}
if
(
$this
->adminEsHelper->
getRefreshIndices
(
)
)
{
$this
->
refreshIndices
(
)
;
}
/** @var array<string, string> $indices */
$indices
=
$this
->connection->
fetchAllKeyValue
(
'SELECT `alias`, `index` FROM admin_elasticsearch_index_task'
)
;
if
(
empty
(
$indices
)
)
{
return
;
}
foreach
(
$this
->indexer
as
$indexer
)
{
$ids
=
$event
->
getPrimaryKeys
(
$indexer
->
getEntity
(
)
)
;