Auth_Basic::addEncryptionHook PHP Метод

addEncryptionHook() публичный Метод

This method will be applied on $this->model, so you should not call it manually. You can call it on a fresh model, however.
public addEncryptionHook ( Model $model )
$model Model
    public function addEncryptionHook($model)
    {
        // If model is saved, encrypt password
        $t = $this;
        if (isset($model->has_encryption_hook) && $model->has_encryption_hook) {
            return;
        }
        $model->has_encryption_hook = true;
        $model->addHook('beforeSave', function ($m) use($t) {
            if ($m->isDirty($t->password_field) && $m[$t->password_field]) {
                $m[$t->password_field] = $t->encryptPassword($m[$t->password_field], $m[$t->login_field]);
            }
        });
    }