Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
setOperations example
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
(
)
;
}
$this
->
getBackupResource
(
)
->
create
(
$results
,
$operations
,
$newBackup
,
$queue
->
getCreated
(
)
?
$queue
->
getCreated
(
)
->
getTimestamp
(
)
:
time
(
)
)
;