src/App/Controller/Web/Sites/NewsController.php line 135

Open in your IDE?
  1. <?php
  2. namespace App\Controller\Web\Sites;
  3. use App\Entity\Content\Posts\Post\PostObject;
  4. use Symfony\Component\HttpFoundation\Response;
  5. use Symfony\Component\Routing\Annotation\Route;
  6. /**
  7.  *
  8.  */
  9. final class NewsController extends AbstractSiteController
  10. {
  11.     const ROUTES__LANDING__ROOT 'app.web.sites.news.landing.root';
  12.     const ROUTES__LANDING__SUB 'app.web.sites.news.landing.sub';
  13.     const ROUTES__SUBSCRIBE__ROOT 'app.web.sites.news.subscribe.root';
  14.     const ROUTES__SUBSCRIBE__SUB 'app.web.sites.news.subscribe.sub';
  15.     const ROUTES__FEED__ROOT 'app.web.sites.news.feed.root';
  16.     const ROUTES__FEED__SUB 'app.web.sites.news.feed.sub';
  17.     const ROUTES__VIEW__ROOT 'app.web.sites.news.view.root';
  18.     const ROUTES__VIEW__SUB 'app.web.sites.news.view.sub';
  19.     /**
  20.      * @param string $host
  21.      * @param string|null $path
  22.      * @return Response
  23.      *
  24.      * @Route(
  25.      *     "/news",
  26.      *     name = self::ROUTES__LANDING__ROOT,
  27.      * )
  28.      * @Route(
  29.      *     "/{path}/news",
  30.      *     name = self::ROUTES__LANDING__SUB,
  31.      *     requirements = {
  32.      *         "path" = ".+",
  33.      *     },
  34.      * )
  35.      */
  36.     public function landingAction(string $host, ?string $path null): Response
  37.     {
  38.         return $this->legacy();
  39.     }
  40.     /**
  41.      * @param string $host
  42.      * @param string|null $path
  43.      * @return Response
  44.      *
  45.      * @Route(
  46.      *     "/news/subscribe",
  47.      *     name = self::ROUTES__SUBSCRIBE__ROOT,
  48.      * )
  49.      * @Route(
  50.      *     "/{path}/news/subscribe",
  51.      *     name = self::ROUTES__SUBSCRIBE__SUB,
  52.      *     requirements = {
  53.      *         "path" = ".+",
  54.      *     },
  55.      * )
  56.      */
  57.     public function subscribeAction(string $host, ?string $path null): Response
  58.     {
  59.         return $this->legacy();
  60.     }
  61.     /**
  62.      * @param string $host
  63.      * @param string $type
  64.      * @param string|null $path
  65.      * @return Response
  66.      *
  67.      * @Route(
  68.      *     "/news/feed/{type}",
  69.      *     name = self::ROUTES__FEED__ROOT,
  70.      *     requirements = {
  71.      *         "type" = "rss",
  72.      *     },
  73.      * )
  74.      * @Route(
  75.      *     "/{path}/news/feed/{type}",
  76.      *     name = self::ROUTES__FEED__SUB,
  77.      *     requirements = {
  78.      *         "path" = ".+",
  79.      *         "type" = "rss",
  80.      *     },
  81.      * )
  82.      */
  83.     public function feedAction(string $hoststring $type, ?string $path null): Response
  84.     {
  85.         return $this->legacy();
  86.     }
  87.     /**
  88.      * @param string $host
  89.      * @param string $id
  90.      * @param string $slug
  91.      * @param string|null $path
  92.      * @return Response
  93.      *
  94.      * @Route(
  95.      *     "/news/{id}/{slug}",
  96.      *     name = self::ROUTES__VIEW__ROOT,
  97.      *     requirements = {
  98.      *         "id" = "[^/]+",
  99.      *         "slug" = "[^/]+",
  100.      *     },
  101.      * )
  102.      * @Route(
  103.      *     "/{path}/news/{id}/{slug}",
  104.      *     name = self::ROUTES__VIEW__SUB,
  105.      *     requirements = {
  106.      *         "path" = ".+",
  107.      *         "id" = "[^/]+",
  108.      *         "slug" = "[^/]+",
  109.      *     },
  110.      * )
  111.      */
  112.     public function viewAction(string $hoststring $idstring $slug, ?string $path null): Response
  113.     {
  114.         return
  115.             $this->handleMigratedContent(
  116.                 PostObject::class,
  117.                 $id,
  118.                 $path self::ROUTES__VIEW__SUB self::ROUTES__VIEW__ROOT,
  119.                 $this->getRequest()->get('_route_params'),
  120.             ) ??
  121.             $this->handleIncorrectSlug(
  122.                 PostObject::class,
  123.                 $id,
  124.                 $slug,
  125.                 $path self::ROUTES__VIEW__SUB self::ROUTES__VIEW__ROOT,
  126.                 $this->getRequest()->get('_route_params'),
  127.             ) ??
  128.             $this->legacy();
  129.     }
  130. }