Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getQueue example
if
(
!
$queue
)
{
throw
new
RuntimeException
(
sprintf
(
'Queue with ID %s not found',
$queueId
)
)
;
}
$operations
=
json_decode
(
$queue
->
getOperations
(
)
, true
)
;
// Wrap all this into a transaction in order to speed up the progress // and to be able to roll it back at some point
$connection
->
beginTransaction
(
)
;
try
{
$details
=
$this
->
getQueue
(
)
->
pop
(
$queueId
,
$this
->
getConfig
(
)
->
getByNamespace
(
'SwagMultiEdit', 'batchItemsPerRequest', 512
)
)
;
if
(
!
empty
(
$details
)
)
{
$this
->
updateDetails
(
$details
,
$operations
)
;
$connection
->
commit
(
)
;
}
}
catch
(
Exception
$e
)
{
$connection
->
rollBack
(
)
;
throw
new
RuntimeException
(
sprintf
(
'Error updating details: %s',
$e
->
getMessage
(
)
)
, 0,
$e
)
;
}
$remaining
=
$queue
->
getArticleDetails
(
)
->
count
(
)
;