Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
fetchByIdentifier example
if
(
$collection
=== null
)
{
continue
;
}
$slotCriteriaList
[
$slot
->
getUniqueIdentifier
(
)
]
=
$collection
;
}
// reduce search requests by combining mergeable criteria objects
[
$directReads
,
$searches
]
=
$this
->
optimizeCriteriaObjects
(
$slotCriteriaList
)
;
// fetch data from storage
$entities
=
$this
->
fetchByIdentifier
(
$directReads
,
$resolverContext
->
getSalesChannelContext
(
)
)
;
$searchResults
=
$this
->
fetchByCriteria
(
$searches
,
$resolverContext
->
getSalesChannelContext
(
)
)
;
// create result for each slot with the requested data
foreach
(
$slots
as
$slotId
=>
$slot
)
{
$resolver
=
$this
->resolvers
[
$slot
->
getType
(
)
]
?? null;
if
(
!
$resolver
)
{
continue
;
}
$result
=
new
ElementDataCollection
(
)
;