src/Frontend/OpenSpaceBundle/Controller/ArticleController.php line 21

Open in your IDE?
  1. <?php
  2. namespace App\Frontend\OpenSpaceBundle\Controller;
  3. use App\AMZ\CoreBundle\Services\AMZS;
  4. use App\AMZ\InquiryBundle\Entity\Inquiry;
  5. use App\AMZ\InquiryBundle\Entity\Project;
  6. use App\AMZ\PostBundle\Entity\Post;
  7. use App\Frontend\OpenSpaceBundle\Services\OpenSpace;
  8. use App\Frontend\OpenSpaceBundle\Services\OpenSpaceService;
  9. use Doctrine\ORM\Persisters\Collection\OneToManyPersister;
  10. use Knp\Component\Pager\PaginatorInterface;
  11. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  12. use Symfony\Component\HttpFoundation\Request;
  13. use Symfony\Component\HttpFoundation\Response;
  14. class ArticleController extends AbstractController
  15. {
  16.     public function indexAction(Request $requestOpenSpaceService $frontendService,PaginatorInterface $paginator){
  17.         $pageSlug OpenSpace::PAGE_ARTICLE_SLUG;
  18.         $page $frontendService->getPageBySlug($pageSlug);
  19.         $articles $frontendService->getArticleByCategorySlug('bai-viet'$request->query->get('page'1));
  20.         return $this->render('@FrontendOpenSpace/Article/index.html.twig', array(
  21.             'articles' => $articles,
  22.             'page' => $page
  23.         ));
  24.     }
  25.     public function detailAction(OpenSpaceService $frontendService$slug){
  26.         $article $frontendService->getArticleBySlug($slug);
  27.         $latestArticles $frontendService->getLatestArticles();
  28.         $olderArticles $frontendService->getOlderArticle($article);
  29.         return $this->render('@FrontendOpenSpace/Article/detail.html.twig',array('article' => $article,'latestArticles' => $latestArticles,'olderArticles' => $olderArticles ));
  30.     }
  31. }
  32. ?>