Selaa lähdekoodia

[FrameworkBundle] Adding a check for the existence of the Doctrine service

Ryan Weaver 14 vuotta sitten
vanhempi
commit
172c956b73
1 muutettua tiedostoa jossa 4 lisäystä ja 0 poistoa
  1. 4 0
      src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php

+ 4 - 0
src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php

@@ -144,6 +144,10 @@ class Controller extends ContainerAware
      */
     public function getDoctrine()
     {
+        if (!$this->has('doctrine')) {
+            throw new \LogicException('The DoctrineBundle is not installed in your application.');
+        }
+
         return $this->get('doctrine');
     }