Немного приемственности в именовании сущностей

This commit is contained in:
ErickSkrauch 2016-05-10 23:28:04 +03:00
parent c6547b6540
commit 15922ba02e
5 changed files with 7 additions and 7 deletions

View File

@ -5,7 +5,7 @@ use api\models\base\ApiForm;
use api\traits\AccountFinder;
use common\components\UserFriendlyRandomKey;
use common\models\Account;
use common\models\confirmations\RecoverPassword;
use common\models\confirmations\ForgotPassword;
use common\models\EmailActivation;
use Yii;
use yii\base\ErrorException;
@ -59,7 +59,7 @@ class ForgotPasswordForm extends ApiForm {
$account = $this->getAccount();
$emailActivation = $this->getEmailActivation();
if ($emailActivation === null) {
$emailActivation = new RecoverPassword();
$emailActivation = new ForgotPassword();
$emailActivation->account_id = $account->id;
} else {
$emailActivation->created_at = time();

View File

@ -73,7 +73,7 @@ class EmailActivation extends ActiveRecord {
public static function getClassMap() {
return [
self::TYPE_REGISTRATION_EMAIL_CONFIRMATION => confirmations\RegistrationConfirmation::class,
self::TYPE_FORGOT_PASSWORD_KEY => confirmations\RecoverPassword::class,
self::TYPE_FORGOT_PASSWORD_KEY => confirmations\ForgotPassword::class,
];
}

View File

@ -4,7 +4,7 @@ namespace common\models\confirmations;
use common\models\EmailActivation;
use yii\helpers\ArrayHelper;
class RecoverPassword extends EmailActivation {
class ForgotPassword extends EmailActivation {
public function behaviors() {
return ArrayHelper::merge(parent::behaviors(), [

View File

@ -22,6 +22,6 @@ return [
'key' => 'H25HBDCHHAG2HGHGHS',
'account_id' => 6,
'type' => \common\models\EmailActivation::TYPE_FORGOT_PASSWORD_KEY,
'created_at' => time() - (new \common\models\confirmations\RecoverPassword())->repeatTimeout - 10,
'created_at' => time() - (new \common\models\confirmations\ForgotPassword())->repeatTimeout - 10,
],
];

View File

@ -2,7 +2,7 @@
namespace codeception\common\unit\models;
use Codeception\Specify;
use common\models\confirmations\RecoverPassword;
use common\models\confirmations\ForgotPassword;
use common\models\confirmations\RegistrationConfirmation;
use common\models\EmailActivation;
use tests\codeception\common\fixtures\EmailActivationFixture;
@ -27,7 +27,7 @@ class EmailActivationTest extends DbTestCase {
]))->isInstanceOf(RegistrationConfirmation::class);
expect(EmailActivation::findOne([
'type' => EmailActivation::TYPE_FORGOT_PASSWORD_KEY,
]))->isInstanceOf(RecoverPassword::class);
]))->isInstanceOf(ForgotPassword::class);
});
}