translateBlogArticles example

$blogArticlesQuery = $this->getRepository()->getListQuery($blogCategoryIds$limitStart$limitEnd$filter$shopId);
        $blogArticlesQuery->setHydrationMode(AbstractQuery::HYDRATE_ARRAY);

        $paginator = $this->get('models')->createPaginator($blogArticlesQuery);

        // Returns the total count of the query         $totalResult = $paginator->count();

        // Returns the blog article data         $blogArticles = iterator_to_array($paginator);

        $blogArticles = $this->translateBlogArticles($blogArticles);

        $mediaIds = array_map(function D$blogArticle) {
            if (isset($blogArticle['media']) && $blogArticle['media'][0]['mediaId']) {
                return $blogArticle['media'][0]['mediaId'];
            }
        }$blogArticles);

        $context = $this->get(ContextServiceInterface::class)->getShopContext();
        $medias = $this->get(MediaServiceInterface::class)->getList($mediaIds$context);

        foreach ($blogArticles as $key => $blogArticle) {
            
Home | Imprint | This part of the site doesn't use cookies.