/** * @Route("/article/{slug}", name="article") */ public function articleAction($slug) { if ($slug == 'test') { $article = Article::testArticle(); } else { /** @var APIService $apiService */ $apiService = $this->get('app.api'); /** @var Article $article */ $article = $apiService->getArticleBySlug($slug); } if (!$article) { throw new NotFoundHttpException(); } return $this->renderWithDefaults('AppBundle:Articles:article.html.twig', ['article' => $article]); }