1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-29 02:02:41 +01:00
phorge-phorge/src/applications/nuance/query/NuanceItemCommandQuery.php
epriestley 1885c4e03b Add an ItemCommand queue to Nuance
Summary:
Ref T10537. Generally, when users interact with Nuance items we'll dump a command into a queue and apply it in the background. This avoids race conditions with multiple users interacting with an item, which Nuance is more subject to than other applications because it has an import/external component.

The "sync" command doesn't actually do anything yet.

Test Plan: {F1186365}

Reviewers: chad

Reviewed By: chad

Subscribers: Luke081515.2

Maniphest Tasks: T10537

Differential Revision: https://secure.phabricator.com/D15506
2016-03-22 15:08:23 -07:00

47 lines
906 B
PHP

<?php
final class NuanceItemCommandQuery
extends NuanceQuery {
private $ids;
private $itemPHIDs;
public function withIDs(array $ids) {
$this->ids = $ids;
return $this;
}
public function withItemPHIDs(array $item_phids) {
$this->itemPHIDs = $item_phids;
return $this;
}
public function newResultObject() {
return new NuanceItemCommand();
}
protected function loadPage() {
return $this->loadStandardPage($this->newResultObject());
}
protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) {
$where = parent::buildWhereClauseParts($conn);
if ($this->ids !== null) {
$where[] = qsprintf(
$conn,
'id IN (%Ld)',
$this->ids);
}
if ($this->itemPHIDs !== null) {
$where[] = qsprintf(
$conn,
'itemPHID IN (%Ls)',
$this->itemPHIDs);
}
return $where;
}
}