1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-02-19 10:18:38 +01:00
phorge-phorge/src/applications/auth/query/PhabricatorAuthProviderConfigQuery.php

78 lines
1.6 KiB
PHP
Raw Normal View History

<?php
final class PhabricatorAuthProviderConfigQuery
extends PhabricatorCursorPagedPolicyAwareQuery {
private $ids;
private $phids;
private $providerClasses;
2019-02-05 05:22:39 -08:00
private $isEnabled;
public function withPHIDs(array $phids) {
$this->phids = $phids;
return $this;
}
public function withIDs(array $ids) {
$this->ids = $ids;
return $this;
}
2019-02-05 05:22:39 -08:00
public function withProviderClasses(array $classes) {
$this->providerClasses = $classes;
return $this;
}
2019-02-05 05:22:39 -08:00
public function withIsEnabled($is_enabled) {
$this->isEnabled = $is_enabled;
return $this;
}
2019-02-05 05:22:39 -08:00
public function newResultObject() {
return new PhabricatorAuthProviderConfig();
}
protected function loadPage() {
2019-02-05 05:22:39 -08:00
return $this->loadStandardPage($this->newResultObject());
}
2019-02-05 05:22:39 -08:00
protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) {
$where = parent::buildWhereClauseParts($conn);
if ($this->ids !== null) {
$where[] = qsprintf(
$conn,
'id IN (%Ld)',
$this->ids);
}
if ($this->phids !== null) {
$where[] = qsprintf(
$conn,
'phid IN (%Ls)',
$this->phids);
}
if ($this->providerClasses !== null) {
$where[] = qsprintf(
$conn,
'providerClass IN (%Ls)',
$this->providerClasses);
}
2019-02-05 05:22:39 -08:00
if ($this->isEnabled !== null) {
$where[] = qsprintf(
$conn,
'isEnabled = %d',
(int)$this->isEnabled);
}
2019-02-05 05:22:39 -08:00
return $where;
}
public function getQueryApplicationClass() {
return 'PhabricatorAuthApplication';
}
}