|
@@ 206-227 (lines=22) @@
|
| 203 |
|
return isset($this->dbRow[$var]); |
| 204 |
|
}*/ |
| 205 |
|
|
| 206 |
|
public function set($var, $value) |
| 207 |
|
{ |
| 208 |
|
$this->_dbLoadIfNotLoaded(); |
| 209 |
|
|
| 210 |
|
/* |
| 211 |
|
// Ok, let's start by checking the column type |
| 212 |
|
$type = $this->db_connection->getColumnType($this->dbTableName, $var); |
| 213 |
|
|
| 214 |
|
// Throws an exception if the type is not ok. |
| 215 |
|
if (!$this->db_connection->checkType($value, $type)) { |
| 216 |
|
throw new TDBMException("Error! Invalid value passed for attribute '$var' of table '$this->dbTableName'. Passed '$value', but expecting '$type'"); |
| 217 |
|
} |
| 218 |
|
*/ |
| 219 |
|
|
| 220 |
|
/*if ($var == $this->getPrimaryKey() && isset($this->dbRow[$var])) |
| 221 |
|
throw new TDBMException("Error! Changing primary key value is forbidden.");*/ |
| 222 |
|
$this->dbRow[$var] = $value; |
| 223 |
|
if ($this->tdbmService !== null && $this->status === TDBMObjectStateEnum::STATE_LOADED) { |
| 224 |
|
$this->status = TDBMObjectStateEnum::STATE_DIRTY; |
| 225 |
|
$this->tdbmService->_addToToSaveObjectList($this); |
| 226 |
|
} |
| 227 |
|
} |
| 228 |
|
|
| 229 |
|
/** |
| 230 |
|
* @param string $foreignKeyName |
|
@@ 233-241 (lines=9) @@
|
| 230 |
|
* @param string $foreignKeyName |
| 231 |
|
* @param AbstractTDBMObject $bean |
| 232 |
|
*/ |
| 233 |
|
public function setRef($foreignKeyName, AbstractTDBMObject $bean = null) |
| 234 |
|
{ |
| 235 |
|
$this->references[$foreignKeyName] = $bean; |
| 236 |
|
|
| 237 |
|
if ($this->tdbmService !== null && $this->status === TDBMObjectStateEnum::STATE_LOADED) { |
| 238 |
|
$this->status = TDBMObjectStateEnum::STATE_DIRTY; |
| 239 |
|
$this->tdbmService->_addToToSaveObjectList($this); |
| 240 |
|
} |
| 241 |
|
} |
| 242 |
|
|
| 243 |
|
/** |
| 244 |
|
* @param string $foreignKeyName A unique name for this reference |