Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getBlogCategoryListIds example
$categoryId
=
(
(int)
$this
->
Request
(
)
->categoryId == 0
)
? 1 :
(int)
$this
->
Request
(
)
->categoryId;
// Order data
$order
=
(array)
$this
->
Request
(
)
->
getParam
(
'sort',
[
]
)
;
/** @var array $filter */
$filter
=
$this
->
Request
(
)
->
getParam
(
'filter',
[
]
)
;
$query
=
$this
->
getCategoryRepository
(
)
->
getBlogCategoriesByParentQuery
(
$categoryId
)
;
$blogCategories
=
$query
->
getArrayResult
(
)
;
$blogCategoryIds
=
$this
->
getBlogCategoryListIds
(
$blogCategories
)
;
$blogCategoryIds
[
]
=
$categoryId
;
$repository
=
$this
->
getRepository
(
)
;
$dataQuery
=
$repository
->
getBackendListQuery
(
$blogCategoryIds
,
$filter
,
$order
,
$offset
,
$limit
)
;
$totalCount
=
$this
->
getManager
(
)
->
getQueryCount
(
$dataQuery
)
;
$data
=
$dataQuery
->
getArrayResult
(
)
;
$this
->
View
(
)
->
assign
(
[
'success' => true, 'data' =>
$data
, 'totalCount' =>
$totalCount
]
)
;
}
catch
(
Exception
$e
)
{
$this
->
View
(
)
->
assign
(
[
'success' => false, 'errorMsg' =>
$e
->
getMessage
(
)
]
)
;
}