summaryrefslogtreecommitdiffstats
path: root/application/models
diff options
context:
space:
mode:
authorSebastian Wagner2011-10-05 15:27:41 +0200
committerSebastian Wagner2011-10-05 15:27:41 +0200
commitabd3a30d827d26713e03471b95271d1bca33567e (patch)
tree93f2985c333e5f43ac6a3233b949509d727a7456 /application/models
parentkleine Korrektur (diff)
downloadpoolctrl-abd3a30d827d26713e03471b95271d1bca33567e.tar.gz
poolctrl-abd3a30d827d26713e03471b95271d1bca33567e.tar.xz
poolctrl-abd3a30d827d26713e03471b95271d1bca33567e.zip
category statistic implemented
Diffstat (limited to 'application/models')
-rwxr-xr-xapplication/models/EventMapper.php40
1 files changed, 18 insertions, 22 deletions
diff --git a/application/models/EventMapper.php b/application/models/EventMapper.php
index 144fb64..7ebb18f 100755
--- a/application/models/EventMapper.php
+++ b/application/models/EventMapper.php
@@ -185,33 +185,29 @@ class Application_Model_EventMapper
}
public function getCategoryCount($poolID) {
-
+
$db = Zend_Db_Table::getDefaultAdapter();
$select = $this->getDbTable()->select()
- ->from($this->_dbTable,
- array('count' => 'COUNT(*)', 'category'))
- ->where('poolctrl_event.pbs_poolID = ?', $poolID)
- ->group('category');
-
- $stmt = $db->query($select);
- $result = $stmt->fetchAll();
-
- return array($result);
+ ->setIntegrityCheck(false)
+ ->from(array('pce' => 'poolctrl_event'),
+ array('count' => 'COUNT(*)', 'category' => 'pcec.title'))
+ ->join(array('pcec' => 'poolctrl_eventcategory'),
+ 'pce.category = pcec.eventcategoryID')
+ ->where('pce.pbs_poolID = ?', $poolID)
+ ->group('pce.category');
+
+ $stmt = $db->query($select);
+ $result = $stmt->fetchAll(PDO::FETCH_NUM);
+
+ return array($result);
}
- /* Erzeugt diese Anfrage:
- // SELECT p."product_id", COUNT(*) AS line_items_per_product
- // FROM "products" AS p JOIN "line_items" AS l
- // ON p.product_id = l.product_id
- // GROUP BY p.product_id
+ /* FROM "products" AS p JOIN "line_items" AS l
+ * ON p.product_id = l.product_id
*
- *
- *
- *
- * SELECT category, COUNT( * ) AS count
- * FROM `poolctrl_event`
- * GROUP BY category
- * LIMIT 0 , 30
+ * ->join(array('l' => 'line_items'),
+ * 'p.product_id = l.product_id');
*/
+
} \ No newline at end of file