diff options
Diffstat (limited to 'framework')
-rw-r--r-- | framework/Data/ActiveRecord/Relations/TActiveRecordRelation.php | 3 | ||||
-rw-r--r-- | framework/Data/ActiveRecord/Scaffold/TScaffoldEditView.php | 8 |
2 files changed, 9 insertions, 2 deletions
diff --git a/framework/Data/ActiveRecord/Relations/TActiveRecordRelation.php b/framework/Data/ActiveRecord/Relations/TActiveRecordRelation.php index 60afef89..de6e5331 100644 --- a/framework/Data/ActiveRecord/Relations/TActiveRecordRelation.php +++ b/framework/Data/ActiveRecord/Relations/TActiveRecordRelation.php @@ -64,7 +64,8 @@ abstract class TActiveRecordRelation static $stack=array();
$results = call_user_func_array(array($this->getSourceRecord(),$method),$args);
- if(is_array($results) || $results instanceof ArrayAccess || $results instanceof TActiveRecord)
+ $validArray = is_array($results) && count($results) > 0;
+ if($validArray || $results instanceof ArrayAccess || $results instanceof TActiveRecord)
{
$this->collectForeignObjects($results);
while($obj = array_pop($stack))
diff --git a/framework/Data/ActiveRecord/Scaffold/TScaffoldEditView.php b/framework/Data/ActiveRecord/Scaffold/TScaffoldEditView.php index 0550864b..ea9b2df5 100644 --- a/framework/Data/ActiveRecord/Scaffold/TScaffoldEditView.php +++ b/framework/Data/ActiveRecord/Scaffold/TScaffoldEditView.php @@ -214,6 +214,12 @@ class TScaffoldEditView extends TScaffoldBase $record->save();
return true;
}
+ else if($this->_editRenderer!==null)
+ {
+ //preserve the form data.
+ $this->_editRenderer->updateRecord($this->getCurrentRecord());
+ }
+
return false;
}
@@ -300,5 +306,5 @@ interface IScaffoldEditRenderer extends IDataRenderer */
public function updateRecord($record);
}
- +
?>
\ No newline at end of file |