hasOne(OauthSession::class, ['id' => 'session_id']); } public function getScopes() { return new Set($this->getDb()->getSchema()->getRawTableName($this->tableName()), $this->access_token, 'scopes'); } public function beforeDelete() { if (!$result = parent::beforeDelete()) { return $result; } $this->getScopes()->delete(); return true; } public function isExpired() : bool { return time() > $this->expire_time; } }