[limb-svn] r7104 - 3.x/trunk/limb/active_record/src
svn at limb-project.com
svn at limb-project.com
Wed Jul 9 18:46:44 MSD 2008
Author: slevin
Date: 2008-07-09 18:46:44 +0400 (Wed, 09 Jul 2008)
New Revision: 7104
URL: http://fisheye.limb-project.com/changelog/limb/?cs=7104
Modified:
3.x/trunk/limb/active_record/src/lmbARRecordSetDecorator.class.php
3.x/trunk/limb/active_record/src/lmbActiveRecord.class.php
Log:
-- used temporary variable in getting inheritance class name
Modified: 3.x/trunk/limb/active_record/src/lmbARRecordSetDecorator.class.php
===================================================================
--- 3.x/trunk/limb/active_record/src/lmbARRecordSetDecorator.class.php 2008-07-09 09:42:05 UTC (rev 7103)
+++ 3.x/trunk/limb/active_record/src/lmbARRecordSetDecorator.class.php 2008-07-09 14:46:44 UTC (rev 7104)
@@ -41,19 +41,20 @@
{
if($path = $record->get(lmbActiveRecord :: getInheritanceField()))
{
- $class_name = end(lmbActiveRecord :: decodeInheritancePath($path));
+ $class_name = lmbActiveRecord :: getInheritanceClass($record);
+
if(!class_exists($class_name))
throw new lmbException("Class '$class_name' not found");
}
else
$class_name = $default_class_name;
-
+
$object = new $class_name(null, $conn);
-
+
$object->loadFromRecord($record);
-
+
return $object;
- }
+ }
function at($pos)
{
@@ -62,7 +63,7 @@
return self :: createObjectFromRecord($record, $this->class_path, $this->conn);
}
-
+
function getIds()
{
$result = array();
Modified: 3.x/trunk/limb/active_record/src/lmbActiveRecord.class.php
===================================================================
--- 3.x/trunk/limb/active_record/src/lmbActiveRecord.class.php 2008-07-09 09:42:05 UTC (rev 7103)
+++ 3.x/trunk/limb/active_record/src/lmbActiveRecord.class.php 2008-07-09 14:46:44 UTC (rev 7104)
@@ -862,7 +862,7 @@
$value = $this->_getRaw($this->_many_belongs_to[$property]['field']);
if(!$value && $this->_canManyBelongsToObjectBeNull($property))
return null;
-
+
if(isset($this->_many_belongs_to[$property]['throw_exception_on_not_found']))
$throw_exception = $this->_many_belongs_to[$property]['throw_exception_on_not_found'];
else
@@ -870,7 +870,7 @@
return self :: findById($this->_many_belongs_to[$property]['class'],
$this->get($this->_many_belongs_to[$property]['field']),
- $throw_exception,
+ $throw_exception,
$this->_db_conn);
}
@@ -879,7 +879,7 @@
$value = $this->_getRaw($this->_has_one[$property]['field']);
if(!$value && $this->_canHasOneObjectBeNull($property))
return null;
-
+
if(isset($this->_has_one[$property]['throw_exception_on_not_found']))
$throw_exception = $this->_has_one[$property]['throw_exception_on_not_found'];
else
@@ -1665,7 +1665,8 @@
static function getInheritanceClass($obj)
{
- return end(self :: decodeInheritancePath($obj[self :: $_inheritance_field]));
+ $decoded_path = self :: decodeInheritancePath($obj[self :: $_inheritance_field]);
+ return end($decoded_path);
}
/**
@@ -2204,13 +2205,13 @@
$this->_db_table->setPrimaryKeyName($this->_primary_key_name);
$this->_db_table_name = $this->_db_table->getTableName();
}
-
+
function __sleep()
{
$vars = array_keys(get_object_vars($this));
$vars = array_diff($vars, array('_db_conn', '_db_table', '_db_meta_info'));
return $vars;
- }
+ }
}
More information about the limb-svn
mailing list