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

What's the difference between notsave() and notsaved()?

According to the docs the explantion of 'notSave()' is

Triggered when the insert/update operation fails for any reason

and I cannot find any information about 'notSaved()' in docs(but it works )

// phalcon version 1.3.4
Class Model extends \Phalcon\Mvc\Model
{
    public $id ;
    public $name;

    public function notSave(){
        echo "calling notSave()";
    }

    public function notSaved(){
        echo "calling notSaved()";
    }
}

$model = new Model();
$model->id = 1;
$model->save();  // return false and calling notSaved();

Any one who can tell me what is the difference between notSave() and notSaved()? In this case , why model did not triigger notSave()?

Thanks!



4.7k
Accepted
answer

Well... i thinking that was a documentation mistake, but i found this: https://github.com/phalcon/cphalcon/issues/2495 - well... in that case, u must use notSaved. Greetings

Well... i thinking that was a documentation mistake, but i found this: https://github.com/phalcon/cphalcon/issues/2495 - well... in that case, u must use notSaved. Greetings

Got it , thanks !

edited Jun '15

Thank u. I will try to commit this in documentation....

One more thing:

Hello, I've removed notSave in 2.0.4 just leaving notSaved

This is info from phalcon developer, so- we are in the right way :)

Greetings