Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
setInitialSize example
$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
(
)
)
;
// Tested this with ~140k products - compared with pure SQL this is reasonable fast // In most cases the filter query will be the bottleneck