},
$blogArticles);
$context =
$this->
get(ContextServiceInterface::
class)->
getShopContext();
$medias =
$this->
get(MediaServiceInterface::
class)->
getList($mediaIds,
$context);
foreach ($blogArticles as $key =>
$blogArticle) { // Adding number of comments to the blog article
$blogArticles[$key]['numberOfComments'
] = \
count($blogArticle['comments'
]);
// Adding tags and tag filter links to the blog article
$tagsData =
$this->repository->
getTagsByBlogId($blogArticle['id'
])->
getArrayResult();
$blogArticles[$key]['tags'
] =
$this->
addLinksToFilter($tagsData, 'sFilterTags', 'name', false
);
// Adding average vote data to the blog article
$avgVoteQuery =
$this->repository->
getAverageVoteQuery($blogArticle['id'
],
$shopId);
$blogArticles[$key]['sVoteAverage'
] =
$avgVoteQuery->
getOneOrNullResult(AbstractQuery::HYDRATE_SINGLE_SCALAR
);
// Adding thumbnails to the blog article
if (empty($blogArticle['media'
][0
]['mediaId'
])) { continue;
}