Throw 404 error if the article cannot be found

This commit is contained in:
Gergely Polonkai 2014-06-23 07:27:04 +00:00
parent a6531be6c5
commit 9f4c0f9f02

View File

@ -73,7 +73,11 @@ class BlogController extends Controller
$query->setParameter(':slug', $slug);
$query->setParameter(':date1', $date);
$query->setParameter(':date2', $date2);
$post = $query->getOneOrNullResult();
if (($post = $query->getOneOrNullResult()) === null) {
throw $this->createNotFoundException('The post you specified does not exist.');
}
$this->get('fpn_tag.tag_manager')->loadTagging($post);
return array(