Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
assignAdditionalText example
ContextServiceInterface
$contextService
,
AdditionalTextServiceInterface
$additionalTextService
)
{
parent::
__construct
(
$entity
,
$entityManager
)
;
$this
->contextService =
$contextService
;
$this
->additionalTextService =
$additionalTextService
;
}
public
function
getList
(
$identifiers
)
{
$products
= parent::
getList
(
$identifiers
)
;
$products
=
$this
->
assignAdditionalText
(
$products
)
;
$products
=
$this
->
assignCategoryIds
(
$products
)
;
$products
=
$this
->
assignPrice
(
$products
)
;
return
$products
;
}
protected
function
createListQuery
(
)
{
$query
=
$this
->entityManager->
createQueryBuilder
(
)
;
$query
->
select
(
[
'variant.id as id',
$query
->
setHydrationMode
(
AbstractQuery::HYDRATE_ARRAY
)
;
$paginator
=
$this
->
getModelManager
(
)
->
createPaginator
(
$query
)
;
// returns the total count of the query
$totalResult
=
$paginator
->
count
(
)
;
// returns the customer data
$result
=
iterator_to_array
(
$paginator
)
;
$products
=
$this
->
buildListProducts
(
$result
)
;
$products
=
$this
->
getAdditionalTexts
(
$products
)
;
$result
=
$this
->
assignAdditionalText
(
$result
,
$products
)
;
$this
->
View
(
)
->
assign
(
[
'data' =>
$result
,
'total' =>
$totalResult
,
'success' => true,
]
)
;
return
;
}
$productId
=
$this
->
Request
(
)
->
getParam
(
'articleId'
)
;