Added Add Node capability

This commit is contained in:
Deon George
2014-10-28 16:33:15 +11:00
parent 83a2c85a25
commit 80c8971a46
11 changed files with 218 additions and 7 deletions

View File

@@ -27,6 +27,7 @@ abstract class ORM_TSM extends ORM {
protected $_formated = FALSE;
protected $_formats = array();
protected $_custom_cols = array();
protected $_tsm = array();
/**
@@ -55,10 +56,31 @@ abstract class ORM_TSM extends ORM {
// Get a substited column name - need for DB2/DSMADMC schema differences
if (isset($this->_tsm[$this->_db_group]['translate']) AND array_key_exists($column,$this->_tsm[$this->_db_group]['translate']))
return is_null($c=$this->_tsm[$this->_db_group]['translate'][$column]) ? NULL : parent::__get($c);
else
return parent::__get($column);
}
public function __set($column,$value) {
if (in_array($column,$this->_custom_cols)) {
// See if the data really changed
if (! isset($this->_object[$column]) OR $value !== $this->_object[$column]) {
$this->_table_columns[$column]['data_type'] = 'custom';
$this->_object[$column] = $value;
// Data has changed
$this->_changed[$column] = $column;
// Object is no longer saved or valid
$this->_saved = $this->_valid = FALSE;
}
} else
parent::__set($column,$value);
}
public function find() {
Log::instance()->add(LOG::DEBUG,'ENTER :method',array(':method'=>__METHOD__));
@@ -170,5 +192,12 @@ abstract class ORM_TSM extends ORM {
return array_key_exists($type,$x) ? $x[$type] : $x;
}
public function values(array $values,array $expected=NULL) {
foreach (array_intersect(array_keys($values),$this->_custom_cols) as $col)
$this->_table_columns[$col]['data_type'] = 'custom';
return parent::values($values,$expected);
}
}
?>