We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

hasMany & show after modification

Hello I want to changing some data in hasMany property

exp.

current data in hasMany [1,2,3]

$data = []
$data[] = <obj 4>

foreach($master->hasManyCollections as $item) {
    if($item->id == 1) {
        $item->delete();
    }
}
$master->hasManyCollections = $data;
$master->save();

foreach($master->hasManyCollections as $item) {
    var_dump($item->id);
}

I want to show this items [2,3,4] but have [1,2,3] even adding setIsFresh to false, but after refresh page is OK

How to show current collections after model->save or before where the more I care because of the validation

Hi @macagn1984 to get real relationships you must use getRelated('alias', [optinal params]) method like a getter