]> git.andy128k.dev Git - ipf-legacy-orm.git/commitdiff
table::findAll respects orderable template now
authorAndrey Kutejko <andy128k@gmail.com>
Mon, 25 Nov 2013 19:22:06 +0000 (21:22 +0200)
committerAndrey Kutejko <andy128k@gmail.com>
Mon, 25 Nov 2013 19:22:52 +0000 (21:22 +0200)
ipf/orm/table.php

index b2708b245cd76859bc24f50bbb01b5375c8e39e1..62081036bea91c6a9c690126f29d9dd3a4063aed 100644 (file)
@@ -524,8 +524,11 @@ class IPF_ORM_Table extends IPF_ORM_Configurable implements Countable
     public function findAll($hydrationMode = null)
     {
         $q = $this->createQuery();
-        if ($this->_ordering)
+        if ($this->_ordering) {
             $q->orderBy(implode(', ', $this->_ordering));
+        } elseif ($this->hasTemplate('IPF_ORM_Template_Orderable')) {
+            $q->orderBy($this->getTemplate('IPF_ORM_Template_Orderable')->getColumnName());
+        }
         return $q->execute(array(), $hydrationMode);
     }