summaryrefslogtreecommitdiff
path: root/framework/Data/ActiveRecord
diff options
context:
space:
mode:
authorwei <>2007-09-05 01:43:17 +0000
committerwei <>2007-09-05 01:43:17 +0000
commit9db6e012559ae7bdb46a9519c360bb936173f200 (patch)
treee85d0aace7888df21dcf892866e566b25ff5e244 /framework/Data/ActiveRecord
parent78af8b5719980ba12c391e20ecabdf3703452b05 (diff)
typos in blog tutorial. fixed empty result in active record relations. fixed keeping of post data in scaffold edit view when using renderer.
Diffstat (limited to 'framework/Data/ActiveRecord')
-rw-r--r--framework/Data/ActiveRecord/Relations/TActiveRecordRelation.php3
-rw-r--r--framework/Data/ActiveRecord/Scaffold/TScaffoldEditView.php8
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