[limb-svn] r5541 - in 3.x/trunk/limb/active_record: src tests/cases
svn at limb-project.com
svn at limb-project.com
Thu Apr 5 17:31:01 MSD 2007
Author: pachanga
Date: 2007-04-05 17:31:01 +0400 (Thu, 05 Apr 2007)
New Revision: 5541
URL: http://fisheye.limb-project.com/changelog/limb/?cs=5541
Modified:
3.x/trunk/limb/active_record/src/lmbActiveRecord.class.php
3.x/trunk/limb/active_record/tests/cases/lmbActiveRecordImportTest.class.php
Log:
-- passing lmbActiveRecord object in constructor calls import
Modified: 3.x/trunk/limb/active_record/src/lmbActiveRecord.class.php
===================================================================
--- 3.x/trunk/limb/active_record/src/lmbActiveRecord.class.php 2007-04-05 13:27:34 UTC (rev 5540)
+++ 3.x/trunk/limb/active_record/src/lmbActiveRecord.class.php 2007-04-05 13:31:01 UTC (rev 5541)
@@ -162,7 +162,7 @@
if(is_int($magic_params))
$this->loadById($magic_params);
- elseif(is_array($magic_params))
+ elseif(is_array($magic_params) || is_object($magic_params))
$this->import($magic_params);
}
Modified: 3.x/trunk/limb/active_record/tests/cases/lmbActiveRecordImportTest.class.php
===================================================================
--- 3.x/trunk/limb/active_record/tests/cases/lmbActiveRecordImportTest.class.php 2007-04-05 13:27:34 UTC (rev 5540)
+++ 3.x/trunk/limb/active_record/tests/cases/lmbActiveRecordImportTest.class.php 2007-04-05 13:31:01 UTC (rev 5541)
@@ -81,6 +81,19 @@
$this->assertTrue($object2->isDirty());
}
+ function testPassingActiveRecordToConstructorCallsImport()
+ {
+ $object1 = new TestOneTableObject();
+ $object1->setAnnotation($annotation = 'Some annotation');
+ $object1->save();
+
+ $object2 = new TestOneTableObject($object1);
+ $this->assertEqual($object2->getId(), $object1->getId());
+ $this->assertEqual($object2->getAnnotation(), $annotation);
+ $this->assertFalse($object2->isNew());
+ $this->assertTrue($object2->isDirty());
+ }
+
function testImportActiveRecordWithLazyAttributes()
{
$object = new LazyTestOneTableObject();
More information about the limb-svn
mailing list