[icinga-checkins] icinga.org: icinga-web/r1.6: * Doctrine obtain connection fix for default connection icinga

git at icinga.org git at icinga.org
Fri Dec 2 10:10:25 CET 2011


Module: icinga-web
Branch: r1.6
Commit: 47c9d88131a99beef232592a1de0042ef4c4994d
URL:    https://git.icinga.org/?p=icinga-web.git;a=commit;h=47c9d88131a99beef232592a1de0042ef4c4994d

Author: Marius Hein <marius.hein at netways.de>
Date:   Fri Dec  2 10:05:17 2011 +0100

* Doctrine obtain connection fix for default connection icinga

---

 .../lib/database/IcingaDoctrine_Query.class.php    |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/app/modules/Api/lib/database/IcingaDoctrine_Query.class.php b/app/modules/Api/lib/database/IcingaDoctrine_Query.class.php
index a5b8532..45a3222 100644
--- a/app/modules/Api/lib/database/IcingaDoctrine_Query.class.php
+++ b/app/modules/Api/lib/database/IcingaDoctrine_Query.class.php
@@ -8,11 +8,18 @@ class IcingaDoctrine_Query extends Doctrine_Query {
      * @return IcingaDoctrine_Query
      */
     public static function create($conn = NULL, $class = NULL) {
+        $manager = Doctrine_Manager::getInstance();
         
         if (!($conn instanceof Doctrine_Connection) && $conn) {
-            $conn = Doctrine_Manager::getInstance()->getConnection($conn);
+            $conn = $manager->getConnection($conn);
+        } else {
+            $conn = $manager->getConnection('icinga');
         }
         
+        $conn_name = $manager->getConnectionName($conn);
+        
+        AgaviContext::getInstance()->getLoggerManager()->log('QUERY::CREATE Obtain doctrine connection: '. $conn_name, AgaviLogger::DEBUG);
+        
         return parent::create($conn, 'IcingaDoctrine_Query');
     }
     





More information about the icinga-checkins mailing list