I hacked it like this. Static props don't save. I'd still like to know if there is a way to have a non-saving class property.
class Customer extends Phalcon\Mvc\Collection {
// static properties not saved to Collection
private static $currSubscription = null;
// load Subscription when initialized
public function initialize() {
$this->getSubscription();
}
// load the Subscription when subscription id set
public function setSubscriptionId($subId) {
$this->subscriptionId = $subId;
$this->getSubscription();
return $this;
}
// get the Subscription
public function getSubscription() {
// only load if Subscription not loaded and subscription id set
if(!self::$currSubscription && isset($this->subscriptionId) && $this->subscriptionId) {
// load Subscription by id
self::$currSubscription = Subscription::findById($this->subscriptionId);
}
return self::$currSubscription;
}
}