Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

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?



11.5k

What happens if you try to update another field?



7.4k
Accepted
answer

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

check skipping-columns