Changeset View
Changeset View
Standalone View
Standalone View
src/applications/legalpad/query/LegalpadDocumentSignatureQuery.php
<?php | <?php | ||||
final class LegalpadDocumentSignatureQuery | final class LegalpadDocumentSignatureQuery | ||||
extends PhabricatorCursorPagedPolicyAwareQuery { | extends PhabricatorCursorPagedPolicyAwareQuery { | ||||
private $ids; | private $ids; | ||||
private $phids; | |||||
private $documentPHIDs; | private $documentPHIDs; | ||||
private $signerPHIDs; | private $signerPHIDs; | ||||
private $documentVersions; | private $documentVersions; | ||||
private $secretKeys; | private $secretKeys; | ||||
private $nameContains; | private $nameContains; | ||||
private $emailContains; | private $emailContains; | ||||
public function withIDs(array $ids) { | public function withIDs(array $ids) { | ||||
$this->ids = $ids; | $this->ids = $ids; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function withPHIDs(array $phids) { | |||||
$this->phids = $phids; | |||||
return $this; | |||||
} | |||||
public function withDocumentPHIDs(array $phids) { | public function withDocumentPHIDs(array $phids) { | ||||
$this->documentPHIDs = $phids; | $this->documentPHIDs = $phids; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function withSignerPHIDs(array $phids) { | public function withSignerPHIDs(array $phids) { | ||||
$this->signerPHIDs = $phids; | $this->signerPHIDs = $phids; | ||||
return $this; | return $this; | ||||
Show All 14 Lines | public function withNameContains($text) { | ||||
return $this; | return $this; | ||||
} | } | ||||
public function withEmailContains($text) { | public function withEmailContains($text) { | ||||
$this->emailContains = $text; | $this->emailContains = $text; | ||||
return $this; | return $this; | ||||
} | } | ||||
protected function loadPage() { | public function newResultObject() { | ||||
$table = new LegalpadDocumentSignature(); | return new LegalpadDocumentSignature(); | ||||
$conn_r = $table->establishConnection('r'); | } | ||||
$data = queryfx_all( | |||||
$conn_r, | |||||
'SELECT * FROM %T %Q %Q %Q', | |||||
$table->getTableName(), | |||||
$this->buildWhereClause($conn_r), | |||||
$this->buildOrderClause($conn_r), | |||||
$this->buildLimitClause($conn_r)); | |||||
protected function loadPage() { | |||||
$table = $this->newResultObject(); | |||||
$data = $this->loadStandardPageRows($table); | |||||
$signatures = $table->loadAllFromArray($data); | $signatures = $table->loadAllFromArray($data); | ||||
return $signatures; | return $signatures; | ||||
} | } | ||||
protected function willFilterPage(array $signatures) { | protected function willFilterPage(array $signatures) { | ||||
$document_phids = mpull($signatures, 'getDocumentPHID'); | $document_phids = mpull($signatures, 'getDocumentPHID'); | ||||
$documents = id(new LegalpadDocumentQuery()) | $documents = id(new LegalpadDocumentQuery()) | ||||
->setParentQuery($this) | ->setParentQuery($this) | ||||
Show All 22 Lines | protected function buildWhereClause(AphrontDatabaseConnection $conn) { | ||||
if ($this->ids !== null) { | if ($this->ids !== null) { | ||||
$where[] = qsprintf( | $where[] = qsprintf( | ||||
$conn, | $conn, | ||||
'id IN (%Ld)', | 'id IN (%Ld)', | ||||
$this->ids); | $this->ids); | ||||
} | } | ||||
if ($this->phids !== null) { | |||||
$where[] = qsprintf( | |||||
$conn, | |||||
'phid IN (%Ls)', | |||||
$this->phids); | |||||
} | |||||
if ($this->documentPHIDs !== null) { | if ($this->documentPHIDs !== null) { | ||||
$where[] = qsprintf( | $where[] = qsprintf( | ||||
$conn, | $conn, | ||||
'documentPHID IN (%Ls)', | 'documentPHID IN (%Ls)', | ||||
$this->documentPHIDs); | $this->documentPHIDs); | ||||
} | } | ||||
if ($this->signerPHIDs !== null) { | if ($this->signerPHIDs !== null) { | ||||
▲ Show 20 Lines • Show All 42 Lines • Show Last 20 Lines |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0