Contrôleur Galerie/View, 404 si galerie existe pas
authorSébastien CHAZALLET <s.chazallet@gmail.com>
Wed, 7 Nov 2012 14:24:31 +0000 (15:24 +0100)
committerSébastien CHAZALLET <s.chazallet@gmail.com>
Wed, 7 Nov 2012 14:24:31 +0000 (15:24 +0100)
module/Galerie/src/Galerie/Controller/IndexController.php

index 3fd3a47..66892fa 100644 (file)
@@ -49,11 +49,16 @@ class IndexController extends AbstractActionController
     } 
 
     public function viewAction() 
-    { 
+    {
+        $galerie = $this->_getGalerieInfoTable()->any(
+            $this->params()->fromRoute('id', null)
+        );
+        if (!$galerie) {
+            $this->getResponse()->setStatusCode(404);
+            return;
+        }
         return new ViewModel(array(
-            'galerie' => $this->_getGalerieInfoTable()->one(
-                $this->params()->fromRoute('id', null)
-            ),
-        )); 
+            'galerie' => $galerie,
+        ));
     } 
 }