summaryrefslogtreecommitdiff
path: root/framework/Data
diff options
context:
space:
mode:
authorxue <>2007-09-30 00:49:07 +0000
committerxue <>2007-09-30 00:49:07 +0000
commit925eb88b45d87db5c03ca3df3a13d8575f258988 (patch)
tree34c5583cb8ec6e1479f024e3b330262552ed49f3 /framework/Data
parent54e9feab491bcf8d1a95b486b68605cb4441e603 (diff)
Change of AR due to introduction of column mapping.
Diffstat (limited to 'framework/Data')
-rw-r--r--framework/Data/ActiveRecord/Relations/TActiveRecordBelongsTo.php6
-rw-r--r--framework/Data/ActiveRecord/Relations/TActiveRecordHasMany.php2
-rw-r--r--framework/Data/ActiveRecord/Relations/TActiveRecordHasManyAssociation.php4
-rw-r--r--framework/Data/ActiveRecord/Relations/TActiveRecordHasOne.php4
-rw-r--r--framework/Data/ActiveRecord/Relations/TActiveRecordRelation.php6
-rw-r--r--framework/Data/ActiveRecord/Relations/TActiveRecordRelationContext.php4
-rw-r--r--framework/Data/ActiveRecord/Scaffold/InputBuilder/TScaffoldInputBase.php6
-rw-r--r--framework/Data/ActiveRecord/Scaffold/TScaffoldBase.php4
8 files changed, 18 insertions, 18 deletions
diff --git a/framework/Data/ActiveRecord/Relations/TActiveRecordBelongsTo.php b/framework/Data/ActiveRecord/Relations/TActiveRecordBelongsTo.php
index 5d20476c..d7278d64 100644
--- a/framework/Data/ActiveRecord/Relations/TActiveRecordBelongsTo.php
+++ b/framework/Data/ActiveRecord/Relations/TActiveRecordBelongsTo.php
@@ -101,7 +101,7 @@ class TActiveRecordBelongsTo extends TActiveRecordRelation
{
if(count($collections[$hash]) > 1)
throw new TActiveRecordException('ar_belongs_to_multiple_result');
- $source->{$prop} = $collections[$hash][0];
+ $source->setColumnValue($prop, $collections[$hash][0]);
}
}
@@ -112,7 +112,7 @@ class TActiveRecordBelongsTo extends TActiveRecordRelation
public function updateAssociatedRecords()
{
$obj = $this->getContext()->getSourceRecord();
- $fkObject = $obj->{$this->getContext()->getProperty()};
+ $fkObject = $obj->getColumnValue($this->getContext()->getProperty());
$registry = $fkObject->getRecordManager()->getObjectStateRegistry();
if($registry->shouldPersistObject($fkObject))
{
@@ -122,7 +122,7 @@ class TActiveRecordBelongsTo extends TActiveRecordRelation
$source = $this->getSourceRecord();
$fkeys = $this->findForeignKeys($source, $fkObject);
foreach($fkeys as $srcKey => $fKey)
- $source->{$srcKey} = $fkObject->{$fKey};
+ $source->setColumnValue($srcKey, $fkObject->getColumnValue($fKey));
return true;
}
}
diff --git a/framework/Data/ActiveRecord/Relations/TActiveRecordHasMany.php b/framework/Data/ActiveRecord/Relations/TActiveRecordHasMany.php
index fea78e36..cbba3ebd 100644
--- a/framework/Data/ActiveRecord/Relations/TActiveRecordHasMany.php
+++ b/framework/Data/ActiveRecord/Relations/TActiveRecordHasMany.php
@@ -105,7 +105,7 @@ class TActiveRecordHasMany extends TActiveRecordRelation
if($registry->shouldPersistObject($fkObjects[$i]))
{
foreach($fkeys as $fKey => $srcKey)
- $fkObjects[$i]->{$fKey} = $source->{$srcKey};
+ $fkObjects[$i]->setColumnValue($fKey, $source->getColumnValue($srcKey));
$success = $fkObjects[$i]->save() && $success;
}
}
diff --git a/framework/Data/ActiveRecord/Relations/TActiveRecordHasManyAssociation.php b/framework/Data/ActiveRecord/Relations/TActiveRecordHasManyAssociation.php
index 7e942e67..0e176607 100644
--- a/framework/Data/ActiveRecord/Relations/TActiveRecordHasManyAssociation.php
+++ b/framework/Data/ActiveRecord/Relations/TActiveRecordHasManyAssociation.php
@@ -215,7 +215,7 @@ class TActiveRecordHasManyAssociation extends TActiveRecordRelation
{
$i=0;
foreach($foreignKeys as $ref=>$fk)
- $obj->{$ref} = $row[$this->_association_columns[$i++]];
+ $obj->setColumnValue($ref, $row[$this->_association_columns[$i++]]);
}
return $obj;
}
@@ -372,7 +372,7 @@ class TActiveRecordHasManyAssociation extends TActiveRecordRelation
{
$data=array();
foreach($foreignKeys as $name=>$fKey)
- $data[$name] = $fkObject->{$fKey};
+ $data[$name] = $fkObject->getColumnValue($fKey);
return $data;
}
}
diff --git a/framework/Data/ActiveRecord/Relations/TActiveRecordHasOne.php b/framework/Data/ActiveRecord/Relations/TActiveRecordHasOne.php
index 375c38ef..b22428ae 100644
--- a/framework/Data/ActiveRecord/Relations/TActiveRecordHasOne.php
+++ b/framework/Data/ActiveRecord/Relations/TActiveRecordHasOne.php
@@ -116,7 +116,7 @@ class TActiveRecordHasOne extends TActiveRecordRelation
{
if(count($collections[$hash]) > 1)
throw new TActiveRecordException('ar_belongs_to_multiple_result');
- $source->{$prop} = $collections[$hash][0];
+ $source->setColumnValue($prop, $collections[$hash][0]);
}
}
@@ -133,7 +133,7 @@ class TActiveRecordHasOne extends TActiveRecordRelation
$source = $this->getSourceRecord();
$fkeys = $this->findForeignKeys($fkObject, $source);
foreach($fkeys as $fKey => $srcKey)
- $fkObject->{$fKey} = $source->{$srcKey};
+ $fkObject->setColumnValue($fKey, $source->getColumnValue($srcKey));
return $fkObject->save();
}
return true;
diff --git a/framework/Data/ActiveRecord/Relations/TActiveRecordRelation.php b/framework/Data/ActiveRecord/Relations/TActiveRecordRelation.php
index de6e5331..5a3ea50e 100644
--- a/framework/Data/ActiveRecord/Relations/TActiveRecordRelation.php
+++ b/framework/Data/ActiveRecord/Relations/TActiveRecordRelation.php
@@ -110,7 +110,7 @@ abstract class TActiveRecordRelation
{
$ids=array();
foreach($properties as $property)
- $ids[] = is_object($obj) ? $obj->{$property} : $obj[$property];
+ $ids[] = is_object($obj) ? $obj->getColumnValue($property) : $obj[$property];
return sprintf('%x',crc32(serialize($ids)));
}
@@ -142,7 +142,7 @@ abstract class TActiveRecordRelation
{
$value = array();
foreach($keys as $name)
- $value[] = $result->{$name};
+ $value[] = $result->getColumnValue($name);
$values[] = $value;
}
return $values;
@@ -190,7 +190,7 @@ abstract class TActiveRecordRelation
{
$hash = $this->getObjectHash($source, $properties);
$prop = $this->getContext()->getProperty();
- $source->{$prop} = isset($collections[$hash]) ? $collections[$hash] : array();
+ $source->setColumnValue($prop, isset($collections[$hash]) ? $collections[$hash] : array());
}
}
diff --git a/framework/Data/ActiveRecord/Relations/TActiveRecordRelationContext.php b/framework/Data/ActiveRecord/Relations/TActiveRecordRelationContext.php
index c9b47d12..189d2c5e 100644
--- a/framework/Data/ActiveRecord/Relations/TActiveRecordRelationContext.php
+++ b/framework/Data/ActiveRecord/Relations/TActiveRecordRelationContext.php
@@ -74,7 +74,7 @@ class TActiveRecordRelationContext
public function getPropertyValue()
{
$obj = $this->getSourceRecord();
- return $obj->{$this->getProperty()};
+ return $obj->getColumnValue($this->getProperty());
}
/**
@@ -185,7 +185,7 @@ class TActiveRecordRelationContext
if(($updateBelongsTo && $belongsTo) || (!$updateBelongsTo && !$belongsTo))
{
$obj = $this->getSourceRecord();
- if(!$this->isEmptyFkObject($obj->{$property}))
+ if(!$this->isEmptyFkObject($obj->getColumnValue($property)))
{
$context = new self($this->getSourceRecord(),$property);
$success = $context->getRelationHandler()->updateAssociatedRecords() && $success;
diff --git a/framework/Data/ActiveRecord/Scaffold/InputBuilder/TScaffoldInputBase.php b/framework/Data/ActiveRecord/Scaffold/InputBuilder/TScaffoldInputBase.php
index 1df0910b..f189e642 100644
--- a/framework/Data/ActiveRecord/Scaffold/InputBuilder/TScaffoldInputBase.php
+++ b/framework/Data/ActiveRecord/Scaffold/InputBuilder/TScaffoldInputBase.php
@@ -68,7 +68,7 @@ class TScaffoldInputBase
if($this->getIsEnabled($column, $record))
{
$prop = $column->getColumnId();
- $record->{$prop} = $this->getControlValue($item->_input, $column, $record);
+ $record->setColumnValue($prop, $this->getControlValue($item->_input, $column, $record));
}
}
@@ -80,7 +80,7 @@ class TScaffoldInputBase
protected function getRecordPropertyValue($column, $record)
{
- $value = $record->{$column->getColumnId()};
+ $value = $record->getColumnValue($column->getColumnId());
if($column->getDefaultValue()!==TDbTableColumn::UNDEFINED_VALUE && $value===null)
return $column->getDefaultValue();
else
@@ -89,7 +89,7 @@ class TScaffoldInputBase
protected function setRecordPropertyValue($item, $record, $input)
{
- $record->{$item->getCustomData()} = $input->getText();
+ $record->setColumnValue($item->getCustomData(), $input->getText());
}
protected function createControl($container, $column, $record)
diff --git a/framework/Data/ActiveRecord/Scaffold/TScaffoldBase.php b/framework/Data/ActiveRecord/Scaffold/TScaffoldBase.php
index 503bbb5e..c233cab4 100644
--- a/framework/Data/ActiveRecord/Scaffold/TScaffoldBase.php
+++ b/framework/Data/ActiveRecord/Scaffold/TScaffoldBase.php
@@ -55,7 +55,7 @@ abstract class TScaffoldBase extends TTemplateControl
{
$data = array();
foreach($this->getTableInfo()->getColumns() as $name=>$column)
- $data[] = $record->{$name};
+ $data[] = $record->getColumnValue($name);
return $data;
}
@@ -68,7 +68,7 @@ abstract class TScaffoldBase extends TTemplateControl
foreach($this->getTableInfo()->getColumns() as $name=>$column)
{
if($column->getIsPrimaryKey())
- $data[] = $record->{$name};
+ $data[] = $record->getColumnValue($name);
}
return $data;
}