Changeset View
Changeset View
Standalone View
Standalone View
src/applications/phragment/query/PhragmentFragmentVersionQuery.php
| Show First 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | $data = queryfx_all( | ||||
| $table->getTableName(), | $table->getTableName(), | ||||
| $this->buildWhereClause($conn_r), | $this->buildWhereClause($conn_r), | ||||
| $this->buildOrderClause($conn_r), | $this->buildOrderClause($conn_r), | ||||
| $this->buildLimitClause($conn_r)); | $this->buildLimitClause($conn_r)); | ||||
| return $table->loadAllFromArray($data); | return $table->loadAllFromArray($data); | ||||
| } | } | ||||
| protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { | protected function buildWhereClause(AphrontDatabaseConnection $conn) { | ||||
| $where = array(); | $where = array(); | ||||
| if ($this->ids) { | if ($this->ids) { | ||||
| $where[] = qsprintf( | $where[] = qsprintf( | ||||
| $conn_r, | $conn, | ||||
| 'id IN (%Ld)', | 'id IN (%Ld)', | ||||
| $this->ids); | $this->ids); | ||||
| } | } | ||||
| if ($this->phids) { | if ($this->phids) { | ||||
| $where[] = qsprintf( | $where[] = qsprintf( | ||||
| $conn_r, | $conn, | ||||
| 'phid IN (%Ls)', | 'phid IN (%Ls)', | ||||
| $this->phids); | $this->phids); | ||||
| } | } | ||||
| if ($this->fragmentPHIDs) { | if ($this->fragmentPHIDs) { | ||||
| $where[] = qsprintf( | $where[] = qsprintf( | ||||
| $conn_r, | $conn, | ||||
| 'fragmentPHID IN (%Ls)', | 'fragmentPHID IN (%Ls)', | ||||
| $this->fragmentPHIDs); | $this->fragmentPHIDs); | ||||
| } | } | ||||
| if ($this->sequences) { | if ($this->sequences) { | ||||
| $where[] = qsprintf( | $where[] = qsprintf( | ||||
| $conn_r, | $conn, | ||||
| 'sequence IN (%Ld)', | 'sequence IN (%Ld)', | ||||
| $this->sequences); | $this->sequences); | ||||
| } | } | ||||
| if ($this->sequenceBefore !== null) { | if ($this->sequenceBefore !== null) { | ||||
| $where[] = qsprintf( | $where[] = qsprintf( | ||||
| $conn_r, | $conn, | ||||
| 'sequence < %d', | 'sequence < %d', | ||||
| $this->sequenceBefore); | $this->sequenceBefore); | ||||
| } | } | ||||
| $where[] = $this->buildPagingClause($conn_r); | $where[] = $this->buildPagingClause($conn); | ||||
| return $this->formatWhereClause($where); | return $this->formatWhereClause($conn, $where); | ||||
| } | } | ||||
| protected function willFilterPage(array $page) { | protected function willFilterPage(array $page) { | ||||
| $fragments = array(); | $fragments = array(); | ||||
| $fragment_phids = array_filter(mpull($page, 'getFragmentPHID')); | $fragment_phids = array_filter(mpull($page, 'getFragmentPHID')); | ||||
| if ($fragment_phids) { | if ($fragment_phids) { | ||||
| $fragments = id(new PhabricatorObjectQuery()) | $fragments = id(new PhabricatorObjectQuery()) | ||||
| Show All 23 Lines | |||||