I want to set a property against a Model that isn't persisted to the database- it will simply hold an array of validation errors that the model encounters whilst processing in my application. My problem is, is that everytime I access my getter for the relation, the values seem to disapper:
public function getAddresses($params = null) {
return $this->getRelated("addresses", array(
"conditions" => "[OrderAddress].active = 'Y'"
));
}
Looking at the SQL statements, everytime I access getAddresses
, as expected, it takes a trip to the database so I am guessing the model is reloaded each time. I tried accessing the relation directly using it's alias, and although that only results in a single trip to the database, the values are still not available on the next iteration of the relation.
Is there a way to basically have Phalcon keep the collection in memory so that everytime I want to loop over the collection, it doesn't reload the model?