From 5ed9a9cdf368fd47362651e7a35a6fcbd2a1a54e Mon Sep 17 00:00:00 2001
From: Peter Rotich <peter@osticket.com>
Date: Fri, 5 Dec 2014 05:39:44 +0000
Subject: [PATCH] orm: SqlAggregate

Fix misspelled class and add expression support to SqlAggregate
---
 include/class.orm.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/class.orm.php b/include/class.orm.php
index de3434cc1..c3b815318 100644
--- a/include/class.orm.php
+++ b/include/class.orm.php
@@ -803,12 +803,12 @@ class QuerySet implements IteratorAggregate, ArrayAccess, Serializable {
         if (!is_array($annotations))
             $annotations = func_get_args();
         foreach ($annotations as $name=>$A) {
-            if ($A instanceof Aggregate) {
+            if ($A instanceof SqlAggregate) {
                 if (is_int($name))
                     $name = $A->getFieldName();
                 $A->setAlias($name);
-                $this->annotations[$name] = $A;
             }
+            $this->annotations[$name] = $A;
         }
         return $this;
     }
-- 
GitLab