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

Model save() not save data

there is code:

    $email = $this->request->getPost('email', 'email');

    $user = users::findFirst(array(
        "email = :email: AND active = 1",
        "bind" => array('email' => $email)
    ));

    if ($user != false) {
        $newPassword = $this->generatePassword(mt_rand (8, 12));
        $hashedPassword = password_hash($newPassword, PASSWORD_DEFAULT);

        $user->password = $hashedPassword;

        var_dump($user->save());

        foreach ($user->getMessages() as $message) {
            echo $message, "\n";
        }

        exit;
    }

but the data in the column "password" are not updated!

although var_dump($user->save()); returns "bool(true)" and does not display any messages

tell me, what's wrong?



16.4k

What happens if you try to update another field?



10.5k
Accepted
answer

maybe "password" field is in your model's "skip columns" lists.

check skipping-columns