Перенесена логика join операции для современных серверов.

Нужно признать, что перенесена она так себе, но в будущем я обязательно это перепишу.
This commit is contained in:
ErickSkrauch
2016-09-03 01:54:22 +03:00
parent 762fab447b
commit 34d725abe2
19 changed files with 543 additions and 6 deletions

View File

@@ -53,8 +53,8 @@ class MinecraftAccessKey extends ActiveRecord {
return $this->hasOne(Account::class, ['id' => 'account_id']);
}
public function isActual() : bool {
return $this->updated_at + self::LIFETIME >= time();
public function isExpired() : bool {
return time() > $this->updated_at + self::LIFETIME;
}
}

View File

@@ -39,7 +39,7 @@ class OauthAccessToken extends ActiveRecord {
return true;
}
public function isExpired() {
public function isExpired() : bool {
return time() > $this->expire_time;
}

View File

@@ -0,0 +1,23 @@
<?php
namespace common\validators;
use InvalidArgumentException;
use Ramsey\Uuid\Uuid;
use yii\validators\Validator;
class UuidValidator extends Validator {
public $skipOnEmpty = false;
public $message = '{attribute} must be valid uuid';
public function validateAttribute($model, $attribute) {
try {
$uuid = Uuid::fromString($model->$attribute)->toString();
$model->$attribute = $uuid;
} catch (InvalidArgumentException $e) {
$this->addError($model, $attribute, $this->message, []);
}
}
}