Pārlūkot izejas kodu

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

Ryan Weaver 14 gadi atpakaļ
vecāks
revīzija
172c956b73

+ 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');
     }