mirror of
https://github.com/elyby/accounts.git
synced 2025-05-31 14:11:46 +05:30
Implementation of the backend for the OAuth2 clients management
This commit is contained in:
34
common/models/OauthClientQuery.php
Normal file
34
common/models/OauthClientQuery.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace common\models;
|
||||
|
||||
use yii\db\ActiveQuery;
|
||||
use yii\db\Command;
|
||||
|
||||
/**
|
||||
* @see OauthClient
|
||||
*/
|
||||
class OauthClientQuery extends ActiveQuery {
|
||||
|
||||
private $showDeleted = false;
|
||||
|
||||
public function includeDeleted(): self {
|
||||
$this->showDeleted = true;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function onlyDeleted(): self {
|
||||
$this->showDeleted = true;
|
||||
return $this->andWhere(['is_deleted' => true]);
|
||||
}
|
||||
|
||||
public function createCommand($db = null): Command {
|
||||
if ($this->showDeleted === false) {
|
||||
$this->andWhere(['is_deleted' => false]);
|
||||
}
|
||||
|
||||
return parent::createCommand($db);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user