From 9acc00369f8bc982a501150a45cee819cfb2ec37 Mon Sep 17 00:00:00 2001 From: Antonio Ramirez Date: Thu, 15 Jun 2017 00:29:03 +0200 Subject: [PATCH] fix model's initialization bugs --- src/User/Command/CreateController.php | 1 + src/User/Model/Profile.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/User/Command/CreateController.php b/src/User/Command/CreateController.php index 0534289..24a9fcd 100644 --- a/src/User/Command/CreateController.php +++ b/src/User/Command/CreateController.php @@ -28,6 +28,7 @@ class CreateController extends Controller /** @var User $user */ $user = $this->make( User::class, + [], ['scenario' => 'create', 'email' => $email, 'username' => $username, 'password' => $password] ); $mailService = MailFactory::makeWelcomeMailerService($user); diff --git a/src/User/Model/Profile.php b/src/User/Model/Profile.php index 6e1151b..949ac86 100644 --- a/src/User/Model/Profile.php +++ b/src/User/Model/Profile.php @@ -72,7 +72,7 @@ class Profile extends ActiveRecord 'timeZoneValidation' => [ 'timezone', function ($attribute) { - if ($this->make(TimeZoneValidator::class, [$attribute])->validate()) { + if ($this->make(TimeZoneValidator::class, [$this->{$attribute}])->validate()) { $this->addError($attribute, Yii::t('usuario', 'Time zone is not valid')); } },