Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/edges/query/PhabricatorEdgeQuery.php
| Show First 20 Lines • Show All 284 Lines • ▼ Show 20 Lines | |||||
| /* -( Internals )---------------------------------------------------------- */ | /* -( Internals )---------------------------------------------------------- */ | ||||
| /** | /** | ||||
| * @task internal | * @task internal | ||||
| */ | */ | ||||
| protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { | protected function buildWhereClause(AphrontDatabaseConnection $conn) { | ||||
| $where = array(); | $where = array(); | ||||
| if ($this->sourcePHIDs) { | if ($this->sourcePHIDs) { | ||||
| $where[] = qsprintf( | $where[] = qsprintf( | ||||
| $conn_r, | $conn, | ||||
| 'edge.src IN (%Ls)', | 'edge.src IN (%Ls)', | ||||
| $this->sourcePHIDs); | $this->sourcePHIDs); | ||||
| } | } | ||||
| if ($this->edgeTypes) { | if ($this->edgeTypes) { | ||||
| $where[] = qsprintf( | $where[] = qsprintf( | ||||
| $conn_r, | $conn, | ||||
| 'edge.type IN (%Ls)', | 'edge.type IN (%Ls)', | ||||
| $this->edgeTypes); | $this->edgeTypes); | ||||
| } | } | ||||
| if ($this->destPHIDs) { | if ($this->destPHIDs) { | ||||
| // potentially complain if $this->edgeType was not set | // potentially complain if $this->edgeType was not set | ||||
| $where[] = qsprintf( | $where[] = qsprintf( | ||||
| $conn_r, | $conn, | ||||
| 'edge.dst IN (%Ls)', | 'edge.dst IN (%Ls)', | ||||
| $this->destPHIDs); | $this->destPHIDs); | ||||
| } | } | ||||
| return $this->formatWhereClause($where); | return $this->formatWhereClause($conn, $where); | ||||
| } | } | ||||
| /** | /** | ||||
| * @task internal | * @task internal | ||||
| */ | */ | ||||
| private function buildOrderClause($conn_r) { | private function buildOrderClause($conn_r) { | ||||
| if ($this->order == self::ORDER_NEWEST_FIRST) { | if ($this->order == self::ORDER_NEWEST_FIRST) { | ||||
| return 'ORDER BY edge.dateCreated DESC, edge.seq DESC'; | return 'ORDER BY edge.dateCreated DESC, edge.seq DESC'; | ||||
| } else { | } else { | ||||
| return 'ORDER BY edge.dateCreated ASC, edge.seq ASC'; | return 'ORDER BY edge.dateCreated ASC, edge.seq ASC'; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||