Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
ListingResultStruct example
/** * @return ListingResultStruct */
public
function
getStoreListing
(
ListingRequest
$context
)
{
$store
=
$this
->storePluginService->
getListing
(
$context
)
;
$merged
=
$this
->
getAdditionallyLocalData
(
$store
->
getPlugins
(
)
)
;
return
new
ListingResultStruct
(
$merged
,
$store
->
getTotalCount
(
)
)
;
}
/** * @return PluginStruct[] */
public
function
getLocalListing
(
ListingRequest
$context
)
{
$local
=
$this
->localPluginService->
getListing
(
$context
)
;
'sort' =>
json_encode
(
$context
->
getSortings
(
)
)
,
'filter' =>
json_encode
(
$context
->
getConditions
(
)
)
,
]
;
$data
=
$this
->storeClient->
doGetRequest
(
'/pluginStore/plugins',
$params
)
;
$plugins
=
$this
->hydrator->
hydrateStorePlugins
(
$data
[
'data'
]
)
;
return
new
ListingResultStruct
(
$plugins
,
$data
[
'total'
]
)
;
}
/** * @return PluginStruct|null */
public
function
getPlugin
(
PluginsByTechnicalNameRequest
$context
)
{
$plugins
=
$this
->
getPlugins
(
$context
)
;
->
andWhere
(
'plugin.capability_enable = 1'
)
;
$this
->
addSortings
(
$context
,
$query
)
;
$data
=
$query
->
setFirstResult
(
$context
->
getOffset
(
)
)
->
setMaxResults
(
$context
->
getLimit
(
)
)
->
execute
(
)
->
fetchAll
(
PDO::FETCH_ASSOC
)
;
$plugins
=
$this
->
iteratePlugins
(
$data
,
$context
)
;
return
new
ListingResultStruct
(
$plugins
, \
count
(
$plugins
)
)
;
}
/** * @return PluginStruct|null */
public
function
getPlugin
(
PluginsByTechnicalNameRequest
$context
)
{
$plugins
=
$this
->
getPlugins
(
$context
)
;
return
array_shift
(
$plugins
)
;
}