Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

setHydrateMode

$members->setHydrateMode(Resultset::HYDRATE_OBJECTS);
foreach ($members as $key => $member) {
        $members->name = 'vendor';
}

$this->view->setVar("members", $members);

But I can't get the name in the view of value phalcon, please advise, I don't know what is the cause of the browser or, I can't reply you, thank you for your answer for me has been repeatedly newbie question, my English is not very good, also please understanding



33.6k
Accepted
answer

$members is an inmutable object whose modifications are not kept in memory to reduce memory usage. However you can append every member to an array to force keep it in memory.

$members->setHydrateMode(Resultset::HYDRATE_OBJECTS);

$modified = array();
foreach ($members as $key => $member) {
        $members->name = 'vendor';
        $modified[] = $member;
}

$this->view->setVar("members", $modified);