Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
setLastBacklogId example
if
(
empty
(
$backlogs
)
)
{
return
;
}
while
(
$backlogs
=
$this
->backlogReader->
read
(
$lastId
, 100
)
)
{
$this
->backlogProcessor->
process
(
$shopIndex
,
$backlogs
)
;
$last
=
array_pop
(
$backlogs
)
;
$lastId
=
$last
->
getId
(
)
;
}
$this
->backlogReader->
setLastBacklogId
(
$lastId
)
;
}
private
function
createAlias
(
IndexConfiguration
$configuration
)
{
$currentAlias
=
$configuration
->
getAlias
(
)
;
$aliasExists
=
$this
->client->
indices
(
)
->
existsAlias
(
[
'name' =>
$currentAlias
]
)
;
if
(
$aliasExists
)
{
$this
->
switchAlias
(
$configuration
)
;
return
;
}
return
0;
}
foreach
(
$this
->identifierSelector->
getShops
(
)
as
$shop
)
{
foreach
(
$this
->mappings
as
$mapping
)
{
$index
=
$this
->indexFactory->
createShopIndex
(
$shop
,
$mapping
->
getType
(
)
)
;
$this
->backlogProcessor->
process
(
$index
,
$backlogs
)
;
}
}
$last
=
$backlogs
[
array_key_last
(
$backlogs
)
]
;
$this
->backlogReader->
setLastBacklogId
(
$last
->
getId
(
)
)
;
$io
->
success
(
sprintf
(
'Synchronized %d items', \
count
(
$backlogs
)
)
)
;
return
0;
}
}