<?php
namespace App\Controller\Web\Sites;
use App\Entity\Content\Posts\Post\PostObject;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
/**
*
*/
final class NewsController extends AbstractSiteController
{
const ROUTES__LANDING__ROOT = 'app.web.sites.news.landing.root';
const ROUTES__LANDING__SUB = 'app.web.sites.news.landing.sub';
const ROUTES__SUBSCRIBE__ROOT = 'app.web.sites.news.subscribe.root';
const ROUTES__SUBSCRIBE__SUB = 'app.web.sites.news.subscribe.sub';
const ROUTES__FEED__ROOT = 'app.web.sites.news.feed.root';
const ROUTES__FEED__SUB = 'app.web.sites.news.feed.sub';
const ROUTES__VIEW__ROOT = 'app.web.sites.news.view.root';
const ROUTES__VIEW__SUB = 'app.web.sites.news.view.sub';
/**
* @param string $host
* @param string|null $path
* @return Response
*
* @Route(
* "/news",
* name = self::ROUTES__LANDING__ROOT,
* )
* @Route(
* "/{path}/news",
* name = self::ROUTES__LANDING__SUB,
* requirements = {
* "path" = ".+",
* },
* )
*/
public function landingAction(string $host, ?string $path = null): Response
{
return $this->legacy();
}
/**
* @param string $host
* @param string|null $path
* @return Response
*
* @Route(
* "/news/subscribe",
* name = self::ROUTES__SUBSCRIBE__ROOT,
* )
* @Route(
* "/{path}/news/subscribe",
* name = self::ROUTES__SUBSCRIBE__SUB,
* requirements = {
* "path" = ".+",
* },
* )
*/
public function subscribeAction(string $host, ?string $path = null): Response
{
return $this->legacy();
}
/**
* @param string $host
* @param string $type
* @param string|null $path
* @return Response
*
* @Route(
* "/news/feed/{type}",
* name = self::ROUTES__FEED__ROOT,
* requirements = {
* "type" = "rss",
* },
* )
* @Route(
* "/{path}/news/feed/{type}",
* name = self::ROUTES__FEED__SUB,
* requirements = {
* "path" = ".+",
* "type" = "rss",
* },
* )
*/
public function feedAction(string $host, string $type, ?string $path = null): Response
{
return $this->legacy();
}
/**
* @param string $host
* @param string $id
* @param string $slug
* @param string|null $path
* @return Response
*
* @Route(
* "/news/{id}/{slug}",
* name = self::ROUTES__VIEW__ROOT,
* requirements = {
* "id" = "[^/]+",
* "slug" = "[^/]+",
* },
* )
* @Route(
* "/{path}/news/{id}/{slug}",
* name = self::ROUTES__VIEW__SUB,
* requirements = {
* "path" = ".+",
* "id" = "[^/]+",
* "slug" = "[^/]+",
* },
* )
*/
public function viewAction(string $host, string $id, string $slug, ?string $path = null): Response
{
return
$this->handleMigratedContent(
PostObject::class,
$id,
$path ? self::ROUTES__VIEW__SUB : self::ROUTES__VIEW__ROOT,
$this->getRequest()->get('_route_params'),
) ??
$this->handleIncorrectSlug(
PostObject::class,
$id,
$slug,
$path ? self::ROUTES__VIEW__SUB : self::ROUTES__VIEW__ROOT,
$this->getRequest()->get('_route_params'),
) ??
$this->legacy();
}
}