mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-11 08:06:13 +01:00
b6d745b666
Summary: All classes should extend from some other class. See D13275 for some explanation. Test Plan: `arc unit` Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: epriestley, Korvin Differential Revision: https://secure.phabricator.com/D13283
43 lines
848 B
PHP
43 lines
848 B
PHP
<?php
|
|
|
|
final class DiffusionPathQuery extends Phobject {
|
|
|
|
private $pathIDs;
|
|
|
|
public function withPathIDs(array $path_ids) {
|
|
$this->pathIDs = $path_ids;
|
|
return $this;
|
|
}
|
|
|
|
public function execute() {
|
|
$conn_r = id(new PhabricatorRepository())->establishConnection('r');
|
|
|
|
$where = $this->buildWhereClause($conn_r);
|
|
|
|
$results = queryfx_all(
|
|
$conn_r,
|
|
'SELECT * FROM %T %Q',
|
|
PhabricatorRepository::TABLE_PATH,
|
|
$where);
|
|
|
|
return ipull($results, null, 'id');
|
|
}
|
|
|
|
protected function buildWhereClause(AphrontDatabaseConnection $conn_r) {
|
|
$where = array();
|
|
|
|
if ($this->pathIDs) {
|
|
$where[] = qsprintf(
|
|
$conn_r,
|
|
'id IN (%Ld)',
|
|
$this->pathIDs);
|
|
}
|
|
|
|
if ($where) {
|
|
return 'WHERE ('.implode(') AND (', $where).')';
|
|
} else {
|
|
return '';
|
|
}
|
|
}
|
|
|
|
}
|