custom/plugins/NetzpBlog6/src/Controller/StoreApi/BlogListing/BlogListingRoute.php line 29

  1. <?php declare(strict_types=1);
  2. namespace NetzpBlog6\Controller\StoreApi\BlogListing;
  3. use NetzpBlog6\Helper\BlogHelper;
  4. use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository;
  5. use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria;
  6. use Shopware\Core\Framework\Plugin\Exception\DecorationPatternException;
  7. use Shopware\Core\System\SalesChannel\SalesChannelContext;
  8. use Symfony\Component\Routing\Annotation\Route;
  9. class BlogListingRoute extends AbstractBlogListingRoute
  10. {
  11.     public function __construct(private readonly EntityRepository $blogRepository,
  12.                                 private readonly BlogHelper $helper)
  13.     {
  14.     }
  15.     public function getDecorated(): never
  16.     {
  17.         throw new DecorationPatternException(self::class);
  18.     }
  19.     #[Route(path'/store-api/bloglisting/{navigationId?}'name'store-api.s_plugin_netzp_blog_listing.load'methods: ['GET''POST'], defaults: ['_routeScope' => ['store-api']])]
  20.     public function load($navigationIdCriteria $criteriaSalesChannelContext $salesChannelContext,
  21.                          ?string $categoryId, ?string $authorId, ?array $tags, ?string $sortOrder): BlogListingRouteResponse
  22.     {
  23.         $posts $this->helper->getBlogPosts(
  24.             $criteria$salesChannelContext,
  25.             $categoryId$authorId$tags$sortOrder);
  26.         return new BlogListingRouteResponse($posts);
  27.     }
  28. }