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

onValidationFails

This is so confusing. In method onValidationFails if I use $this->name it will return the name. But if I use $this->userId it returns nothing.

public function onValidationFails(){
    echo $this->name //works
     echo $this->userId //nothing
}


26.3k
edited Jul '14

Can you copy/paste your model class?

Are you setting a userId property on your own or is it an AUTO INCREMENT field? If it is an auto increment I think it is normal that userId is not set - it have not been saved in the database to it doesn't have an ID.