Browse Source

bug fix: Anomalie #101: err 500 changement de langue

bastien 13 years ago
parent
commit
df4286fa0f
1 changed files with 7 additions and 1 deletions
  1. 7 1
      src/Muzich/CoreBundle/Controller/CoreController.php

+ 7 - 1
src/Muzich/CoreBundle/Controller/CoreController.php View File

@@ -12,6 +12,7 @@ use Muzich\CoreBundle\ElementFactory\ElementManager;
12 12
 use Muzich\CoreBundle\Entity\Element;
13 13
 use Symfony\Component\HttpFoundation\RedirectResponse;
14 14
 use Muzich\CoreBundle\Form\Search\ElementSearchForm;
15
+use Symfony\Component\Routing\Exception\ResourceNotFoundException;
15 16
 
16 17
 class CoreController extends Controller
17 18
 {
@@ -37,7 +38,12 @@ class CoreController extends Controller
37 38
       $url_referer
38 39
     );
39 40
     
40
-    $params = $this->get('router')->match($url_referer);
41
+    try {
42
+      $params = $this->get('router')->match($url_referer.'552');
43
+    } catch (ResourceNotFoundException $exc) {
44
+      return $this->redirect($this->generateUrl('home', array('_locale' => $language)));
45
+    }
46
+
41 47
     $params['_locale'] = $language;
42 48
     $route = $params['_route'];
43 49
     unset($params['_route'], $params['_controller']);