From 524831bf290caa9939640c92e62abd54eeff15e6 Mon Sep 17 00:00:00 2001 From: core23 Date: Sat, 16 Jun 2018 18:58:30 +0200 Subject: [PATCH] Use ADR pattern --- src/Action/AbstractPostArchiveAction.php | 84 ++++++++++ src/Action/CollectionPostArchiveAction.php | 56 +++++++ src/Action/CommentListAction.php | 53 +++++++ src/Action/HomeAction.php | 41 +++++ src/Action/ModerateCommentAction.php | 94 +++++++++++ src/Action/MonthlyPostArchiveAction.php | 34 ++++ src/Action/PostArchiveAction.php | 26 ++++ src/Action/TagPostArchiveAction.php | 53 +++++++ src/Action/ViewPostAction.php | 93 +++++++++++ src/Action/YearlyPostArchiveAction.php | 30 ++++ src/Controller/PostController.php | 146 +++++------------- .../SonataNewsExtension.php | 1 + src/Resources/config/actions.xml | 68 ++++++++ src/Resources/config/routing/news.xml | 16 +- 14 files changed, 681 insertions(+), 114 deletions(-) create mode 100644 src/Action/AbstractPostArchiveAction.php create mode 100644 src/Action/CollectionPostArchiveAction.php create mode 100644 src/Action/CommentListAction.php create mode 100644 src/Action/HomeAction.php create mode 100644 src/Action/ModerateCommentAction.php create mode 100644 src/Action/MonthlyPostArchiveAction.php create mode 100644 src/Action/PostArchiveAction.php create mode 100644 src/Action/TagPostArchiveAction.php create mode 100644 src/Action/ViewPostAction.php create mode 100644 src/Action/YearlyPostArchiveAction.php create mode 100644 src/Resources/config/actions.xml diff --git a/src/Action/AbstractPostArchiveAction.php b/src/Action/AbstractPostArchiveAction.php new file mode 100644 index 00000000..9261a4d7 --- /dev/null +++ b/src/Action/AbstractPostArchiveAction.php @@ -0,0 +1,84 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Sonata\NewsBundle\Action; + +use Sonata\NewsBundle\Model\BlogInterface; +use Sonata\NewsBundle\Model\PostManagerInterface; +use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; + +abstract class AbstractPostArchiveAction extends Controller +{ + /** + * @var BlogInterface + */ + private $blog; + + /** + * @var PostManagerInterface + */ + private $postManager; + + /** + * AbstractPostArchiveAction constructor. + * + * @param BlogInterface $blog + * @param PostManagerInterface $postManager + */ + public function __construct(BlogInterface $blog, PostManagerInterface $postManager) + { + $this->blog = $blog; + $this->postManager = $postManager; + } + + /** + * NEXT_MAJOR: make this method protected. + * + * @return Response + */ + final public function renderArchive(Request $request, array $criteria = [], array $parameters = []) + { + $pager = $this->postManager->getPager( + $criteria, + $request->get('page', 1) + ); + + $parameters = array_merge([ + 'pager' => $pager, + 'blog' => $this->blog, + 'tag' => false, + 'collection' => false, + 'route' => $request->get('_route'), + 'route_parameters' => $request->get('_route_params'), + ], $parameters); + + $response = $this->render( + sprintf('@SonataNews/Post/archive.%s.twig', $request->getRequestFormat()), + $parameters + ); + + if ('rss' === $request->getRequestFormat()) { + $response->headers->set('Content-Type', 'application/rss+xml'); + } + + return $response; + } + + /** + * @return PostManagerInterface + */ + final protected function getPostManager() + { + return $this->postManager; + } +} diff --git a/src/Action/CollectionPostArchiveAction.php b/src/Action/CollectionPostArchiveAction.php new file mode 100644 index 00000000..48ed0f83 --- /dev/null +++ b/src/Action/CollectionPostArchiveAction.php @@ -0,0 +1,56 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Sonata\NewsBundle\Action; + +use Sonata\ClassificationBundle\Model\CollectionManagerInterface; +use Sonata\NewsBundle\Model\BlogInterface; +use Sonata\NewsBundle\Model\PostManagerInterface; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; + +final class CollectionPostArchiveAction extends AbstractPostArchiveAction +{ + /** + * @var CollectionManagerInterface + */ + private $collectionManager; + + public function __construct( + BlogInterface $blog, + PostManagerInterface $postManager, + CollectionManagerInterface $collectionManager + ) { + parent::__construct($blog, $postManager); + + $this->collectionManager = $collectionManager; + } + + /** + * @param string $tag + * + * @return Response + */ + public function __invoke(Request $request, $tag) + { + $collection = $this->collectionManager->findOneBy([ + 'slug' => $tag, + 'enabled' => true, + ]); + + if (!$collection || !$collection->getEnabled()) { + throw new NotFoundHttpException('Unable to find the collection'); + } + + return $this->renderArchive($request, ['collection' => $collection], ['collection' => $collection]); + } +} diff --git a/src/Action/CommentListAction.php b/src/Action/CommentListAction.php new file mode 100644 index 00000000..e7600ead --- /dev/null +++ b/src/Action/CommentListAction.php @@ -0,0 +1,53 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Sonata\NewsBundle\Action; + +use Sonata\NewsBundle\Model\CommentInterface; +use Sonata\NewsBundle\Model\CommentManagerInterface; +use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use Symfony\Component\HttpFoundation\Response; + +final class CommentListAction extends Controller +{ + /** + * @var CommentManagerInterface + */ + private $commentManager; + + /** + * CommentListAction constructor. + * + * @param CommentManagerInterface $commentManager + */ + public function __construct(CommentManagerInterface $commentManager) + { + $this->commentManager = $commentManager; + } + + /** + * @param int $postId + * + * @return Response + */ + public function __invoke($postId) + { + $pager = $this->commentManager + ->getPager([ + 'postId' => $postId, + 'status' => CommentInterface::STATUS_VALID, + ], 1, 500); //no limit + + return $this->render('@SonataNews/Post/comments.html.twig', [ + 'pager' => $pager, + ]); + } +} diff --git a/src/Action/HomeAction.php b/src/Action/HomeAction.php new file mode 100644 index 00000000..9b8f4a23 --- /dev/null +++ b/src/Action/HomeAction.php @@ -0,0 +1,41 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Sonata\NewsBundle\Action; + +use Symfony\Component\HttpFoundation\RedirectResponse; +use Symfony\Component\Routing\RouterInterface; + +final class HomeAction +{ + /** + * @var RouterInterface + */ + private $router; + + /** + * HomeAction constructor. + * + * @param RouterInterface $router + */ + public function __construct(RouterInterface $router) + { + $this->router = $router; + } + + /** + * @return RedirectResponse + */ + public function __invoke() + { + return new RedirectResponse($this->router->generate('sonata_news_archive')); + } +} diff --git a/src/Action/ModerateCommentAction.php b/src/Action/ModerateCommentAction.php new file mode 100644 index 00000000..388793fd --- /dev/null +++ b/src/Action/ModerateCommentAction.php @@ -0,0 +1,94 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Sonata\NewsBundle\Action; + +use Sonata\NewsBundle\Model\BlogInterface; +use Sonata\NewsBundle\Model\CommentManagerInterface; +use Sonata\NewsBundle\Util\HashGeneratorInterface; +use Symfony\Component\HttpFoundation\RedirectResponse; +use Symfony\Component\Routing\RouterInterface; +use Symfony\Component\Security\Core\Exception\AccessDeniedException; + +final class ModerateCommentAction +{ + /** + * @var RouterInterface + */ + private $router; + + /** + * @var BlogInterface + */ + private $blog; + + /** + * @var CommentManagerInterface + */ + private $commentManager; + + /** + * @var HashGeneratorInterface + */ + private $hashGenerator; + + /** + * ModerateCommentAction constructor. + * + * @param RouterInterface $router + * @param BlogInterface $blog + * @param CommentManagerInterface $commentManager + * @param HashGeneratorInterface $hashGenerator + */ + public function __construct( + RouterInterface $router, + BlogInterface $blog, + CommentManagerInterface $commentManager, + HashGeneratorInterface $hashGenerator + ) { + $this->router = $router; + $this->blog = $blog; + $this->commentManager = $commentManager; + $this->hashGenerator = $hashGenerator; + } + + /** + * @param string $commentId + * @param string $hash + * @param string $status + * + * @throws AccessDeniedException + * + * @return RedirectResponse + */ + public function __invoke($commentId, $hash, $status) + { + $comment = $this->commentManager->findOneBy(['id' => $commentId]); + + if (!$comment) { + throw new AccessDeniedException(); + } + + $computedHash = $this->hashGenerator->generate($comment); + + if ($computedHash != $hash) { + throw new AccessDeniedException(); + } + + $comment->setStatus($status); + + $this->commentManager->save($comment); + + return new RedirectResponse($this->router->generate('sonata_news_view', [ + 'permalink' => $this->blog->getPermalinkGenerator()->generate($comment->getPost()), + ])); + } +} diff --git a/src/Action/MonthlyPostArchiveAction.php b/src/Action/MonthlyPostArchiveAction.php new file mode 100644 index 00000000..e9509f31 --- /dev/null +++ b/src/Action/MonthlyPostArchiveAction.php @@ -0,0 +1,34 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Sonata\NewsBundle\Action; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; + +final class MonthlyPostArchiveAction extends AbstractPostArchiveAction +{ + /** + * @param string $year + * @param string $month + * + * @return Response + */ + public function __invoke(Request $request, $year, $month) + { + return $this->renderArchive($request, [ + 'date' => $this->getPostManager()->getPublicationDateQueryParts( + sprintf('%d-%d-%d', $year, $month, 1), + 'month' + ), + ], []); + } +} diff --git a/src/Action/PostArchiveAction.php b/src/Action/PostArchiveAction.php new file mode 100644 index 00000000..4e5b8a05 --- /dev/null +++ b/src/Action/PostArchiveAction.php @@ -0,0 +1,26 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Sonata\NewsBundle\Action; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; + +final class PostArchiveAction extends AbstractPostArchiveAction +{ + /** + * @return Response + */ + public function __invoke(Request $request) + { + return $this->renderArchive($request); + } +} diff --git a/src/Action/TagPostArchiveAction.php b/src/Action/TagPostArchiveAction.php new file mode 100644 index 00000000..8c78d0a7 --- /dev/null +++ b/src/Action/TagPostArchiveAction.php @@ -0,0 +1,53 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Sonata\NewsBundle\Action; + +use Sonata\ClassificationBundle\Model\TagManagerInterface; +use Sonata\NewsBundle\Model\BlogInterface; +use Sonata\NewsBundle\Model\PostManagerInterface; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; + +final class TagPostArchiveAction extends AbstractPostArchiveAction +{ + /** + * @var TagManagerInterface + */ + private $tagManager; + + public function __construct(BlogInterface $blog, PostManagerInterface $postManager, TagManagerInterface $tagManager) + { + parent::__construct($blog, $postManager); + + $this->tagManager = $tagManager; + } + + /** + * @param string $tag + * + * @return Response + */ + public function __invoke(Request $request, $tag) + { + $tag = $this->tagManager->findOneBy([ + 'slug' => $tag, + 'enabled' => true, + ]); + + if (!$tag || !$tag->getEnabled()) { + throw new NotFoundHttpException('Unable to find the tag'); + } + + return $this->renderArchive($request, ['tag' => $tag->getSlug()], ['tag' => $tag]); + } +} diff --git a/src/Action/ViewPostAction.php b/src/Action/ViewPostAction.php new file mode 100644 index 00000000..aca8b29a --- /dev/null +++ b/src/Action/ViewPostAction.php @@ -0,0 +1,93 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Sonata\NewsBundle\Action; + +use Sonata\NewsBundle\Model\BlogInterface; +use Sonata\NewsBundle\Model\PostManagerInterface; +use Sonata\SeoBundle\Seo\SeoPageInterface; +use Symfony\Bundle\FrameworkBundle\Controller\Controller; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; +use Symfony\Component\Routing\Generator\UrlGeneratorInterface; + +final class ViewPostAction extends Controller +{ + /** + * @var BlogInterface + */ + private $blog; + + /** + * @var PostManagerInterface + */ + private $postManager; + + /** + * @var SeoPageInterface|null + */ + private $seoPage; + + /** + * ViewPostAction constructor. + * + * @param BlogInterface $blog + * @param PostManagerInterface $postManager + */ + public function __construct(BlogInterface $blog, PostManagerInterface $postManager) + { + $this->blog = $blog; + $this->postManager = $postManager; + } + + /** + * @param string $permalink + * + * @throws NotFoundHttpException + * + * @return Response + */ + public function __invoke($permalink) + { + $post = $this->postManager->findOneByPermalink($permalink, $this->blog); + + if (!$post || !$post->isPublic()) { + throw new NotFoundHttpException('Unable to find the post'); + } + + if ($seoPage = $this->seoPage) { + $seoPage + ->setTitle($post->getTitle()) + ->addMeta('name', 'description', $post->getAbstract()) + ->addMeta('property', 'og:title', $post->getTitle()) + ->addMeta('property', 'og:type', 'blog') + ->addMeta('property', 'og:url', $this->generateUrl('sonata_news_view', [ + 'permalink' => $this->getBlog()->getPermalinkGenerator()->generate($post), + ], UrlGeneratorInterface::ABSOLUTE_URL)) + ->addMeta('property', 'og:description', $post->getAbstract()) + ; + } + + return $this->render('@SonataNews/Post/view.html.twig', [ + 'post' => $post, + 'form' => false, + 'blog' => $this->getBlog(), + ]); + } + + /** + * @param null|SeoPageInterface $seoPage + */ + public function setSeoPage(SeoPageInterface $seoPage = null) + { + $this->seoPage = $seoPage; + } +} diff --git a/src/Action/YearlyPostArchiveAction.php b/src/Action/YearlyPostArchiveAction.php new file mode 100644 index 00000000..13c08c00 --- /dev/null +++ b/src/Action/YearlyPostArchiveAction.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Sonata\NewsBundle\Action; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; + +final class YearlyPostArchiveAction extends AbstractPostArchiveAction +{ + /** + * @param string $year + * + * @return Response + */ + public function __invoke(Request $request, $year) + { + return $this->renderArchive($request, [ + 'date' => $this->getPostManager()->getPublicationDateQueryParts(sprintf('%d-%d-%d', $year, 1, 1), 'year'), + ], []); + } +} diff --git a/src/Controller/PostController.php b/src/Controller/PostController.php index bc7fce8b..a044b393 100644 --- a/src/Controller/PostController.php +++ b/src/Controller/PostController.php @@ -11,9 +11,25 @@ namespace Sonata\NewsBundle\Controller; +// NEXT_MAJOR: remove this file + +@trigger_error( + 'The '.__NAMESPACE__.'\PostController class is deprecated since version 3.x and will be removed in 4.0.' + .' Use '.__NAMESPACE__.'\Action\* classes instead.', + E_USER_DEPRECATED +); + +use Sonata\NewsBundle\Action\CollectionPostArchiveAction; +use Sonata\NewsBundle\Action\CommentListAction; +use Sonata\NewsBundle\Action\HomeAction; +use Sonata\NewsBundle\Action\ModerateCommentAction; +use Sonata\NewsBundle\Action\MonthlyPostArchiveAction; +use Sonata\NewsBundle\Action\PostArchiveAction; +use Sonata\NewsBundle\Action\TagPostArchiveAction; +use Sonata\NewsBundle\Action\ViewPostAction; +use Sonata\NewsBundle\Action\YearlyPostArchiveAction; use Sonata\NewsBundle\Form\Type\CommentType; use Sonata\NewsBundle\Model\BlogInterface; -use Sonata\NewsBundle\Model\CommentInterface; use Sonata\NewsBundle\Model\CommentManagerInterface; use Sonata\NewsBundle\Model\PostInterface; use Sonata\NewsBundle\Model\PostManagerInterface; @@ -24,7 +40,6 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; -use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Security\Core\Exception\AccessDeniedException; class PostController extends Controller @@ -34,7 +49,9 @@ class PostController extends Controller */ public function homeAction() { - return $this->redirect($this->generateUrl('sonata_news_archive')); + $action = $this->container->get(HomeAction::class); + + return $action(); } /** @@ -46,29 +63,9 @@ public function homeAction() */ public function renderArchive(array $criteria = [], array $parameters = [], Request $request = null) { - $request = $this->resolveRequest($request); - - $pager = $this->getPostManager()->getPager( - $criteria, - $request->get('page', 1) - ); - - $parameters = array_merge([ - 'pager' => $pager, - 'blog' => $this->getBlog(), - 'tag' => false, - 'collection' => false, - 'route' => $request->get('_route'), - 'route_parameters' => $request->get('_route_params'), - ], $parameters); - - $response = $this->render(sprintf('@SonataNews/Post/archive.%s.twig', $request->getRequestFormat()), $parameters); + $action = $this->container->get(PostArchiveAction::class); - if ('rss' === $request->getRequestFormat()) { - $response->headers->set('Content-Type', 'application/rss+xml'); - } - - return $response; + return $action->renderArchive($this->resolveRequest($request), $criteria, $parameters); } /** @@ -78,7 +75,9 @@ public function renderArchive(array $criteria = [], array $parameters = [], Requ */ public function archiveAction(Request $request = null) { - return $this->renderArchive(); + $action = $this->container->get(PostArchiveAction::class); + + return $action($this->resolveRequest($request)); } /** @@ -91,18 +90,9 @@ public function archiveAction(Request $request = null) */ public function tagAction($tag, Request $request = null) { - $request = $this->resolveRequest($request); + $action = $this->container->get(TagPostArchiveAction::class); - $tag = $this->get('sonata.classification.manager.tag')->findOneBy([ - 'slug' => $tag, - 'enabled' => true, - ]); - - if (!$tag || !$tag->getEnabled()) { - throw new NotFoundHttpException('Unable to find the tag'); - } - - return $this->renderArchive(['tag' => $tag->getSlug()], ['tag' => $tag], $request); + return $action($this->resolveRequest($request), $tag); } /** @@ -115,18 +105,9 @@ public function tagAction($tag, Request $request = null) */ public function collectionAction($collection, Request $request = null) { - $request = $this->resolveRequest($request); - - $collection = $this->get('sonata.classification.manager.collection')->findOneBy([ - 'slug' => $collection, - 'enabled' => true, - ]); - - if (!$collection || !$collection->getEnabled()) { - throw new NotFoundHttpException('Unable to find the collection'); - } + $action = $this->container->get(CollectionPostArchiveAction::class); - return $this->renderArchive(['collection' => $collection], ['collection' => $collection], $request); + return $action($this->resolveRequest($request), $collection); } /** @@ -138,11 +119,9 @@ public function collectionAction($collection, Request $request = null) */ public function archiveMonthlyAction($year, $month, Request $request = null) { - $request = $this->resolveRequest($request); + $action = $this->container->get(MonthlyPostArchiveAction::class); - return $this->renderArchive([ - 'date' => $this->getPostManager()->getPublicationDateQueryParts(sprintf('%d-%d-%d', $year, $month, 1), 'month'), - ], [], $request); + return $action($this->resolveRequest($request), $year, $month); } /** @@ -153,11 +132,9 @@ public function archiveMonthlyAction($year, $month, Request $request = null) */ public function archiveYearlyAction($year, Request $request = null) { - $request = $this->resolveRequest($request); + $action = $this->container->get(YearlyPostArchiveAction::class); - return $this->renderArchive([ - 'date' => $this->getPostManager()->getPublicationDateQueryParts(sprintf('%d-%d-%d', $year, 1, 1), 'year'), - ], [], $request); + return $action($this->resolveRequest($request), $year); } /** @@ -169,30 +146,9 @@ public function archiveYearlyAction($year, Request $request = null) */ public function viewAction($permalink) { - $post = $this->getPostManager()->findOneByPermalink($permalink, $this->getBlog()); + $action = $this->container->get(ViewPostAction::class); - if (!$post || !$post->isPublic()) { - throw new NotFoundHttpException('Unable to find the post'); - } - - if ($seoPage = $this->getSeoPage()) { - $seoPage - ->setTitle($post->getTitle()) - ->addMeta('name', 'description', $post->getAbstract()) - ->addMeta('property', 'og:title', $post->getTitle()) - ->addMeta('property', 'og:type', 'blog') - ->addMeta('property', 'og:url', $this->generateUrl('sonata_news_view', [ - 'permalink' => $this->getBlog()->getPermalinkGenerator()->generate($post), - ], UrlGeneratorInterface::ABSOLUTE_URL)) - ->addMeta('property', 'og:description', $post->getAbstract()) - ; - } - - return $this->render('@SonataNews/Post/view.html.twig', [ - 'post' => $post, - 'form' => false, - 'blog' => $this->getBlog(), - ]); + return $action($permalink); } /** @@ -214,15 +170,9 @@ public function getSeoPage() */ public function commentsAction($postId) { - $pager = $this->getCommentManager() - ->getPager([ - 'postId' => $postId, - 'status' => CommentInterface::STATUS_VALID, - ], 1, 500); //no limit - - return $this->render('@SonataNews/Post/comments.html.twig', [ - 'pager' => $pager, - ]); + $action = $this->container->get(CommentListAction::class); + + return $action($postId); } /** @@ -325,25 +275,9 @@ public function addCommentAction($id, Request $request = null) */ public function commentModerationAction($commentId, $hash, $status) { - $comment = $this->getCommentManager()->findOneBy(['id' => $commentId]); - - if (!$comment) { - throw new AccessDeniedException(); - } - - $computedHash = $this->get('sonata.news.hash.generator')->generate($comment); - - if ($computedHash != $hash) { - throw new AccessDeniedException(); - } - - $comment->setStatus($status); - - $this->getCommentManager()->save($comment); + $action = $this->container->get(ModerateCommentAction::class); - return new RedirectResponse($this->generateUrl('sonata_news_view', [ - 'permalink' => $this->getBlog()->getPermalinkGenerator()->generate($comment->getPost()), - ])); + return $action($commentId, $hash, $status); } /** diff --git a/src/DependencyInjection/SonataNewsExtension.php b/src/DependencyInjection/SonataNewsExtension.php index d18ff8ae..23ec9a07 100644 --- a/src/DependencyInjection/SonataNewsExtension.php +++ b/src/DependencyInjection/SonataNewsExtension.php @@ -39,6 +39,7 @@ public function load(array $configs, ContainerBuilder $container) $bundles = $container->getParameter('kernel.bundles'); $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); + $loader->load('actions.xml'); $loader->load('orm.xml'); $loader->load('twig.xml'); $loader->load('form.xml'); diff --git a/src/Resources/config/actions.xml b/src/Resources/config/actions.xml new file mode 100644 index 00000000..741c242f --- /dev/null +++ b/src/Resources/config/actions.xml @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Resources/config/routing/news.xml b/src/Resources/config/routing/news.xml index 46ff798f..e29c4133 100644 --- a/src/Resources/config/routing/news.xml +++ b/src/Resources/config/routing/news.xml @@ -4,43 +4,43 @@ SonataNewsBundle:Post:addComment - SonataNewsBundle:Post:archiveMonthly + Sonata\NewsBundle\Action\MonthlyPostArchiveAction html html|rss \d+ \d+ - SonataNewsBundle:Post:tag + Sonata\NewsBundle\Action\TagPostArchiveAction html html|rss - SonataNewsBundle:Post:collection + Sonata\NewsBundle\Action\CollectionPostArchiveAction html html|rss - SonataNewsBundle:Post:archiveYearly + Sonata\NewsBundle\Action\YearlyPostArchiveAction html html|rss \d+ - SonataNewsBundle:Post:archive + Sonata\NewsBundle\Action\PostArchiveAction html html|rss - SonataNewsBundle:Post:commentModeration + Sonata\NewsBundle\Action\ModerateCommentAction - SonataNewsBundle:Post:view + Sonata\NewsBundle\Action\ViewPostActionn html html|rss .+? - SonataNewsBundle:Post:home + Sonata\NewsBundle\Action\HomeAction