This question is a cross-between data-model and templates, and the answer may be very obvious - as I'm very new to PHP:
I have a class that extends DataObject, and that I have added an additional private member property that I don't want serialised to the database, but that I do want to access during the template processing stage. For example:
class Deal extends DataObject {
static $db = array(
.......
);
private $cachedProperty;
public function setCachedProperty( $value) {
$this->cachedProperty = $value;
}
public function getCachedProperty() {
return $this->cachedProperty;
}
}
In my Page Controller I have a function that returns a list of Deal instances, but before it returns them, it sets this property above on each of them.
The problem is, when I call the function from my template, it always returns nothing for that property. I have put logging into the getCachedProperty() method and have verified that the template is invoking it, but it always seems to be empty.
Does anyone know why this is happening, and if there is something I can do to sort it out?