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
}


16.8k
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.