I don\'t want anyone saying \"you should not reinvent the wheel, use an open source ORM\"; I have an immediate requirement and cannot switch.
I\'m doing a l
I would make a proxy to set for example:
class BaseModel {
protected function _set($attr, $value) {
$current = $this->_get($attr);
if($value !== $current) {
$this->is_dirty = true;
}
$this->$attr = $value;
}
}
Then each child class would implemnt its setter by calling _set()
and never set the property directly. Further, you can always inject more class specific code into each sub class's _set
and just call parent::set($attr, $processedValue)
if needed. Then if you want to use magic methods you make those proxy to property method that proxies to _set
. I suppose this isnt very POPO though.