models/RegistrationForm.php
public function register() {
        if (!$this->validate()) {
            return false;
        }

        /** @var User $user */
        $user = Yii::createObject(User::className());
        $user->setScenario('register');
        $this->loadAttributes($user);

        if (!$user->register()) {
            return false;
        }

        Yii::$app->session->setFlash(
                'info', Yii::t('user', 'Your account has been created and a message with further instructions has been sent to your email')
        );

        return true;
    }
public function register() {
        if (!$this->validate()) {
            return false;
        }

        /** @var User $user */
        $user = Yii::createObject(User::className());
        $user->setScenario('register');
        $this->loadAttributes($user);

        if (!$user->register()) {
            return false;
        }

        Yii::$app->session->setFlash(
                'info', Yii::t('user', 'Your account has been created and a message with further instructions has been sent to your email')
        );

        return true;
    }
Registers a new user account. If registration was successful it will set flash message.

@return bool