Phalcon's ResultSet
is great, only storing one record in memory at a time, but it's causing me real headaches trying to add custom data to an object after it's been pulled from the database.
My indexAction() looks like so:
$webm = new MyModel();
$visas = $webm->customFindFunction($variable);
foreach ($visas as $visa) {
$randomVar = $webm->otherFindFunction($visa->id);
$visa->newParam = $randomVar;
}
$this->view->visas = $visas;
However, because newParam
is not part of the Model and because the object is not saved between rows, by the time it's pushed to the view, it's lost (removed from memory and not saved). Is there any way around this? newParam
is literally only needed on the View...
If I print_r()
within the for
loop I can see my newParam
being assigned, but if I print_r()
after it has ended, it's gone again.