[limb-svn] r7046 - in 3.x/trunk/limb/active_record: src tests/cases
svn at limb-project.com
svn at limb-project.com
Tue May 27 18:12:38 MSD 2008
Author: serega
Date: 2008-05-27 18:12:38 +0400 (Tue, 27 May 2008)
New Revision: 7046
URL: http://fisheye.limb-project.com/changelog/limb/?cs=7046
Modified:
3.x/trunk/limb/active_record/src/lmbARQuery.class.php
3.x/trunk/limb/active_record/tests/cases/lmbARQueryTest.class.php
Log:
-- lmbARQuery :: getRecordSet() method added.
Modified: 3.x/trunk/limb/active_record/src/lmbARQuery.class.php
===================================================================
--- 3.x/trunk/limb/active_record/src/lmbARQuery.class.php 2008-05-27 09:23:02 UTC (rev 7045)
+++ 3.x/trunk/limb/active_record/src/lmbARQuery.class.php 2008-05-27 14:12:38 UTC (rev 7046)
@@ -74,6 +74,13 @@
$this->sort_params[$field] = $type;
}
+ function getRecordSet()
+ {
+ $rs = parent :: getRecordSet();
+ $rs->sort($this->sort_params);
+ return $rs;
+ }
+
function fetch($decorate = true)
{
$this->_applyJoins($this->base_object, $this->join_relations);
Modified: 3.x/trunk/limb/active_record/tests/cases/lmbARQueryTest.class.php
===================================================================
--- 3.x/trunk/limb/active_record/tests/cases/lmbARQueryTest.class.php 2008-05-27 09:23:02 UTC (rev 7045)
+++ 3.x/trunk/limb/active_record/tests/cases/lmbARQueryTest.class.php 2008-05-27 14:12:38 UTC (rev 7046)
@@ -47,6 +47,19 @@
$this->assertEqual($arr[1]->getAnnotation(), $object2->getAnnotation());
}
+ function testGetRecordSetWIthSort()
+ {
+ $object1 = $this->creator->createOneTableObject(10);
+ $object2 = $this->creator->createOneTableObject(20);
+
+ $query = lmbARQuery :: create('TestOneTableObject', array('sort' => array('ordr' => 'DESC')), $this->conn);
+ $iterator = $query->getRecordSet();
+ $arr = $iterator->getArray();
+
+ $this->assertEqual($arr[0]->get('annotation'), $object2->getAnnotation());
+ $this->assertEqual($arr[1]->get('annotation'), $object1->getAnnotation());
+ }
+
function testFetch_Join_RelatedHasOneObject()
{
$person1 = $this->creator->createPerson();
More information about the limb-svn
mailing list