[icinga-checkins] icinga.org: icinga-web/mfriedrich/fixes: * Doctrine query fix to allow connection configuration

git at icinga.org git at icinga.org
Mon Dec 12 23:40:59 CET 2011


Module: icinga-web
Branch: mfriedrich/fixes
Commit: a579e2642ebd39dbb7f8cd01aea1c55fd6b9f3de
URL:    https://git.icinga.org/?p=icinga-web.git;a=commit;h=a579e2642ebd39dbb7f8cd01aea1c55fd6b9f3de

Author: Marius Hein <marius.hein at netways.de>
Date:   Thu Dec  1 14:05:46 2011 +0100

* Doctrine query fix to allow connection configuration

---

 .../lib/database/IcingaDoctrine_Query.class.php    |   14 +++++++++++++-
 .../to/icinga-tactical-overview-template-cv.xml    |    2 +-
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/app/modules/Api/lib/database/IcingaDoctrine_Query.class.php b/app/modules/Api/lib/database/IcingaDoctrine_Query.class.php
index 8ff3244..a5b8532 100644
--- a/app/modules/Api/lib/database/IcingaDoctrine_Query.class.php
+++ b/app/modules/Api/lib/database/IcingaDoctrine_Query.class.php
@@ -1,7 +1,19 @@
 <?php
 class IcingaDoctrine_Query extends Doctrine_Query {
+    
+    /**
+     * Enter description here ...
+     * @param mixed $conn
+     * @param mixed $class
+     * @return IcingaDoctrine_Query
+     */
     public static function create($conn = NULL, $class = NULL) {
-        return new IcingaDoctrine_Query($conn);
+        
+        if (!($conn instanceof Doctrine_Connection) && $conn) {
+            $conn = Doctrine_Manager::getInstance()->getConnection($conn);
+        }
+        
+        return parent::create($conn, 'IcingaDoctrine_Query');
     }
     
     /**
diff --git a/app/modules/Cronks/data/xml/to/icinga-tactical-overview-template-cv.xml b/app/modules/Cronks/data/xml/to/icinga-tactical-overview-template-cv.xml
index 33149ec..2f0e4f9 100644
--- a/app/modules/Cronks/data/xml/to/icinga-tactical-overview-template-cv.xml
+++ b/app/modules/Cronks/data/xml/to/icinga-tactical-overview-template-cv.xml
@@ -29,7 +29,7 @@
 				<div style="padding: 5px 5px;">
                 <?php 
                 
-                    $records = IcingaDoctrine_Query::create()
+                    $records = IcingaDoctrine_Query::create('icinga')
                     ->from('IcingaCustomvariables c')
                     ->distinct(true)
                     ->select('c.varname, c.varvalue')





More information about the icinga-checkins mailing list