+ Added a way to get the original value of a single property for a DataModel
This commit is contained in:
parent
b5d0d18f50
commit
0b13e3562d
1 changed files with 18 additions and 1 deletions
|
@ -91,7 +91,7 @@ class DataModel extends Model
|
|||
// без отслеживания
|
||||
if (\strpos($name, '__') === 0) {
|
||||
$track = null;
|
||||
$name = substr($name, 2);
|
||||
$name = \substr($name, 2);
|
||||
// с отслеживанием
|
||||
} else {
|
||||
$track = false;
|
||||
|
@ -117,4 +117,21 @@ class DataModel extends Model
|
|||
$this->modified[$name] = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Возвращает значение свойства
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function __get($name)
|
||||
{
|
||||
if (\strpos($name, '__') === 0) {
|
||||
$name = \substr($name, 2);
|
||||
return isset($this->a[$name]) ? $this->a[$name] : null;
|
||||
} else {
|
||||
return parent::__get($name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue