[limb-svn] r7095 - 3.x/trunk/limb/active_record/src
svn at limb-project.com
svn at limb-project.com
Mon Jul 7 09:38:40 MSD 2008
Author: pachanga
Date: 2008-07-07 09:38:40 +0400 (Mon, 07 Jul 2008)
New Revision: 7095
URL: http://fisheye.limb-project.com/changelog/limb/?cs=7095
Modified:
3.x/trunk/limb/active_record/src/lmbActiveRecord.class.php
Log:
-- postponing _savePreRelations() as much as possible in case of the new object
Modified: 3.x/trunk/limb/active_record/src/lmbActiveRecord.class.php
===================================================================
--- 3.x/trunk/limb/active_record/src/lmbActiveRecord.class.php 2008-07-06 18:56:52 UTC (rev 7094)
+++ 3.x/trunk/limb/active_record/src/lmbActiveRecord.class.php 2008-07-07 05:38:40 UTC (rev 7095)
@@ -961,7 +961,12 @@
$this->_invokeListeners(self :: ON_BEFORE_SAVE);
- $this->_savePreRelations();
+ //_savePreRelations makes the object dirty if related objects were changed
+ //in case of the new object we don't care since it will be saved anyway
+ //but in case of the existing object we must make sure it's dirty
+ //otherwise it won't be saved
+ if(!$this->isNew())
+ $this->_savePreRelations();
if(!$this->isNew() && $this->isDirty())
{
@@ -996,6 +1001,8 @@
$this->_invokeListeners(self :: ON_BEFORE_CREATE);
+ $this->_savePreRelations();
+
if($need_validation && !$this->_validateInsert())
{
$this->_is_being_saved = false;
More information about the limb-svn
mailing list