Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
QueueModel example
list
(
$results
,
$totalCount
)
=
$this
->
getFilterResource
(
)
->
getPaginatedResult
(
$query
)
;
if
(
!
empty
(
$queueId
)
)
{
$newBackup
= false;
/** @var QueueModel|null $queue */
$queue
=
$entityManager
->
find
(
QueueModel::
class
,
$queueId
)
;
if
(
!
$queue
)
{
throw
new
RuntimeException
(
sprintf
(
'Queue with ID %s not found',
$queueId
)
)
;
}
}
else
{
$newBackup
= true;
$queue
=
new
QueueModel
(
'product'
)
;
$queue
->
setFilterString
(
$filterString
)
;
$queue
->
setOperations
(
json_encode
(
$operations
)
)
;
$queue
->
setCreated
(
new
DateTime
(
)
)
;
$queue
->
setActive
(
false
)
;
$queue
->
setInitialSize
(
$totalCount
)
;
$entityManager
->
persist
(
$queue
)
;
$entityManager
->
flush
(
)
;
$queueId
=
$queue
->
getId
(
)
;
}