We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

Update resultset

Looking at the documentation, a resultset should have an update() function I should be able to use like:

public function initialize(){
public function updateHold(){

However, I get an error saying the function isn't found. Looking at the documentation for the class, there is no mention of the update() function.

So, does it exist? Is there any way to update every record in a resultset?


As you relate the ItemHold as a hasMany relationship you get a resultsetInterface by calling $this->ItemHold. So to update every record you have to loop and update.

foreach ($this->ItemHold as $itemHold) {

I didn't try this ;)

If there is a solution for your last qustion let us know :)

The documentation clearly shows though, that the update() function is available on the ResultSet: https://docs.phalcon.io/en/latest/reference/models.html#updating-related-records