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

update returns true , never update the db field

What is happaning ? I just update a record , without relations and it just doesnt update it but returns true ....

  $loadedModel = $this->model;
    $findModel = $loadedModel::findFirst($this->criteria);   //array("avatar_name = ' asdasdsa' " )

    if (empty($findModel) || !$findModel->update($data)) {     // $findModel->update($data)) is  true
        $this->results = new RepositoryMessages($loadedModel);
    }


17.5k

It could be that $fildModel is empty? Otherwise, use save() instead of update() & see what happens. If you could give more context to your problem I could give a better answer.

Please post more complete code, since we don't know inside the $data and $this->criteria



24.9k
edited Oct '15

Thanks , problem was at the $data array construction :

          $data was array("avatar_name = 'asdasd' ") insted of array("avatar_name " => 'aaaaa')