2018-02-28 03:57:35 +05:30
|
|
|
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace common\models;
|
|
|
|
|
|
|
|
use yii\db\ActiveQuery;
|
|
|
|
use yii\db\Command;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @see OauthClient
|
|
|
|
*/
|
|
|
|
class OauthClientQuery extends ActiveQuery {
|
|
|
|
|
2024-12-02 15:40:55 +05:30
|
|
|
private bool $showDeleted = false;
|
2018-02-28 03:57:35 +05:30
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|