Ash McKenzie Sun Nov 07 17:48:57 -0500 2010

Subject: [SOLVED] Best approach to 'virtual attributes' ?

[UPDATE] Sorry all, I found the answer.. feel like a bit of a dope! -$attributes


Just wondering what's the best approach to achieving 'virtual attributes', similar to ?

I've been using __get() and __set(), but wondering if there's a nicer way ?



Benjamin P Tue Nov 09 10:24:30 -0500 2010

See :
You can define a method set_virtual_name($value) and get_virtual_name() - these will be called by $model->virtual_name.
(Note that for v1.0, you need to declare those setters&getters in the static variables $setters/$getters - nightly build will do it without them.)