public function actionRegister($password, $nickname = null, $firstName = null, $lastName = null)
    {
        $userClass = $this->checkUserClass();
        
        $user = new $userClass(['password' => $password]);
        /* @var $user User */
        $profile = $user->createProfile([
            'nickname' => $nickname,
            'first_name' => $firstName,
            'last_name' => $lastName,
        ]);
        /* @var $profile Profile */
        try {
            is_null($profile) ? $user->register(): $user->register([$profile]);
        } catch (\Exception $ex) {
            throw new Exception($ex->getMessage());
        }
        echo "User Registered:\n";
        return $this->actionShow($user);
    }
public function actionRegister($password, $nickname = null, $firstName = null, $lastName = null)
    {
        $userClass = $this->checkUserClass();
        
        $user = new $userClass(['password' => $password]);
        /* @var $user User */
        $profile = $user->createProfile([
            'nickname' => $nickname,
            'first_name' => $firstName,
            'last_name' => $lastName,
        ]);
        /* @var $profile Profile */
        try {
            is_null($profile) ? $user->register(): $user->register([$profile]);
        } catch (\Exception $ex) {
            throw new Exception($ex->getMessage());
        }
        echo "User Registered:\n";
        return $this->actionShow($user);
    }
public function actionRegister ( $ password , $ nickname = null , $ firstName = null , $ lastName = null ) { $ userClass = $ this -> checkUserClass ( ) ; $ user = new $ userClass ( [ 'password' => $ password ] ) ; /* @var $user User */ $ profile = $ user -> createProfile ( [ 'nickname' => $ nickname , 'first_name' => $ firstName , 'last_name' => $ lastName , ] ) ; /* @var $profile Profile */ try { is_null ( $ profile ) ? $ user -> register ( ) : $ user -> register ( [ $ profile ] ) ; } catch ( \ Exception $ ex ) { throw new Exception ( $ ex -> getMessage ( ) ) ; } echo "User Registered:\n" ; return $ this -> actionShow ( $ user ) ; }
Register new User.
@param string $password Password.
@param string $nickname If profile contains this property, this parameter is required.
@param string $firstName If profile contains this property, this parameter is required.
@param string $lastName If profile contains this propery, this parameter is required.
@return int
@throws Exception
Register new User .