Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getPaginatedResult example
public
function
filter
(
$tokens
,
$offset
,
$limit
,
$orderBy
)
{
$query
=
$this
->
getFilterQuery
(
$tokens
,
$offset
,
$limit
,
$orderBy
)
;
list
(
$result
,
$totalCount
)
=
$this
->
getPaginatedResult
(
$query
)
;
$products
=
$this
->
getDqlHelper
(
)
->
getProductsForListing
(
$result
)
;
$sortedData
=
[
]
;
foreach
(
$result
as
$id
)
{
foreach
(
$products
as
$key
=>
$row
)
{
if
(
$row
[
'Detail_id'
]
==
$id
)
{
$sortedData
[
]
=
$row
;
unset
(
$products
[
$key
]
)
;
break
;
}
}
public
function
create
(
$filterArray
,
$operations
,
$offset
,
$limit
,
$queueId
)
{
$entityManager
=
$this
->
getDqlHelper
(
)
->
getEntityManager
(
)
;
$filterString
=
$this
->
getFilterResource
(
)
->
filterArrayToString
(
$filterArray
)
;
$query
=
$this
->
getFilterResource
(
)
->
getFilterQuery
(
$filterArray
,
$offset
,
$limit
)
;
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'
)
;