Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
fetchPaginatedOneToManyMapping example
$isInheritanceAware
=
$definition
->
isInheritanceAware
(
)
&&
$context
->
considerInheritance
(
)
;
if
(
$isInheritanceAware
)
{
$parentIds
=
array_values
(
\
array_filter
(
$collection
->
map
(
fn
(
Entity
$entity
)
=>
$entity
->
get
(
'parentId'
)
)
)
)
;
$ids
=
array_unique
(
[
...
$ids
, ...
$parentIds
]
)
;
}
$fieldCriteria
->
addFilter
(
new
EqualsAnyFilter
(
$propertyAccessor
,
$ids
)
)
;
$mapping
=
$this
->
fetchPaginatedOneToManyMapping
(
$definition
,
$association
,
$context
,
$collection
,
$fieldCriteria
)
;
$ids
=
[
]
;
foreach
(
$mapping
as
$associationIds
)
{
foreach
(
$associationIds
as
$associationId
)
{
$ids
[
]
=
$associationId
;
}
}
$fieldCriteria
->
setIds
(
\
array_filter
(
$ids
)
)
;
$fieldCriteria
->
resetSorting
(
)
;
$fieldCriteria
->
resetFilters
(
)
;