Koen Punt
Tue Apr 23 18:13:56 -0400 2013
You can define a custom getter http://www.phpactiverecord.xyz/projects/main/wiki/Utilities#attribute-getters
An example:
class Orders extends ActiveRecord\Model {
static $before_save = array('serialize_items');
public function serialize_items(){
$this->items = serialize ( $this->items );
}
public function get_items(){
return unserialize($this->read_attribute('items'));
}
}
(1-1/1)
Subject: after_load method?
I'm quite new to active record, so please excuse if my question seems stupid.
One can hook into "before_save" like:
class Orders extends ActiveRecord\Model {
static $before_save = array('serialize_items');
public function serialize_items(){
$this->items = serialize ( $this->items );
}
}
Is there a corresponding function I can hook in on loading data from the database?
A "after_load" method?