Throw 404 error if the article cannot be found
This commit is contained in:
parent
a6531be6c5
commit
9f4c0f9f02
@ -73,7 +73,11 @@ class BlogController extends Controller
|
|||||||
$query->setParameter(':slug', $slug);
|
$query->setParameter(':slug', $slug);
|
||||||
$query->setParameter(':date1', $date);
|
$query->setParameter(':date1', $date);
|
||||||
$query->setParameter(':date2', $date2);
|
$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);
|
$this->get('fpn_tag.tag_manager')->loadTagging($post);
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
|
Loading…
Reference in New Issue
Block a user