Page MenuHomeClusterLabs Projects
Diviner Tech Docs HeraldRuleQuery

final class HeraldRuleQuery
Phorge Technical Documentation (Herald)

This class is not documented.

Tasks

Formatting Query Clauses

Query Configuration

  • final public function setViewer($viewer) — Set the viewer who is executing the query. Results will be filtered according to the viewer's capabilities. You must set a viewer to execute a policy query.
  • final public function getViewer() — Get the query's viewer.
  • final public function setParentQuery($query) — Set the parent query of this query. This is useful for nested queries so that configuration like whether or not to raise policy exceptions is seamlessly passed along to child queries.
  • final public function getParentQuery() — Get the parent query. See @{method:setParentQuery} for discussion.
  • final public function setRaisePolicyExceptions($bool) — Hook to configure whether this query should raise policy exceptions.
  • final public function shouldRaisePolicyExceptions()
  • final public function requireCapabilities($capabilities)

Executing Queries

  • final public function execute() — Execute the query, loading all visible results.
  • final public function executeOne() — Execute the query, expecting a single result. This method simplifies loading objects for detail pages or edit views.
  • public function getPolicyFilteredPHIDs() — Return a map of all object PHIDs which were loaded in the query but filtered out by policy constraints. This allows a caller to distinguish between objects which do not exist (or, at least, were filtered at the content level) and objects which exist but aren't visible.

Policy Query Implementation

  • final protected function getRawResultLimit() — Get the number of results @{method:loadPage} should load. If the value is 0, @{method:loadPage} should load all available results.
  • protected function willExecute() — Hook invoked before query execution. Generally, implementations should reset any internal cursors.
  • protected function loadPage()
  • final protected function nextPage($page)
  • protected function willFilterPage($rules)
  • protected function didFilterResults($results) — Hook for removing filtered results from alternate result sets. This hook will be called with any objects which were returned by the query but filtered for policy reasons. The query should remove them from any cached or partial result sets.
  • final protected function didLoadResults($results)
  • protected function shouldDisablePolicyFiltering() — Allows a subclass to disable policy filtering. This method is dangerous. It should be used only if the query loads data which has already been filtered (for example, because it wraps some other query which uses normal policy filtering).

Query Cursors

No methods for this task.

Building Query Clauses

Integration with ApplicationSearch

  • public function withApplicationSearchContainsConstraint($index, $value) — Constrain the query with an ApplicationSearch index, requiring field values contain at least one of the values in a set.
  • public function withApplicationSearchRangeConstraint($index, $min, $max) — Constrain the query with an ApplicationSearch index, requiring values exist in a given range.
  • protected function getApplicationSearchObjectPHIDColumn($conn) — Get the name of the query's primary object PHID column, for constructing JOIN clauses. Normally (and by default) this is just `"phid"`, but it may be something more exotic.
  • protected function getApplicationSearchMayJoinMultipleRows() — Determine if the JOINs built by ApplicationSearch might cause each primary object to return multiple result rows. Generally, this means the query needs an extra GROUP BY clause.
  • protected function buildApplicationSearchGroupClause($conn) — Construct a GROUP BY clause appropriate for ApplicationSearch constraints.
  • protected function buildApplicationSearchJoinClause($conn) — Construct a JOIN clause appropriate for applying ApplicationSearch constraints.
  • protected function buildApplicationSearchWhereClause($conn) — Construct a WHERE clause appropriate for applying ApplicationSearch constraints.

Integration with CustomField

Paging

Result Ordering

Working with Edge Logic

Working with Spaces

  • public function withSpacePHIDs($space_phids) — Constrain the query to return results from only specific Spaces.
  • private function buildSpacesWhereClause($conn) — Constrain the query to include only results in valid Spaces.

Other Methods

workspace

  • public function putObjectsInWorkspace($objects) — Put a map of objects into the query workspace. Many queries perform subqueries, which can eventually end up loading the same objects more than once (often to perform policy checks).
  • public function getObjectsFromWorkspace($phids) — Retrieve objects from the query workspace. For more discussion about the workspace mechanism, see @{method:putObjectsInWorkspace}. This method searches both the current query's workspace and the workspaces of parent queries.

Methods

final public function execute()
Inherited

PhabricatorPolicyAwareQuery

Execute the query, loading all visible results.

Return
list<PhabricatorPolicyInterface>Result objects.

protected function formatWhereClause($conn, $parts)
Inherited

This method is not documented.
Parameters
AphrontDatabaseConnection$conn
array$parts
Return
wild

protected function formatSelectClause($conn, $parts)
Inherited

This method is not documented.
Parameters
AphrontDatabaseConnection$conn
array$parts
Return
wild

protected function formatJoinClause($conn, $parts)
Inherited

This method is not documented.
Parameters
AphrontDatabaseConnection$conn
array$parts
Return
wild

protected function formatHavingClause($conn, $parts)
Inherited

This method is not documented.
Parameters
AphrontDatabaseConnection$conn
array$parts
Return
wild

private function flattenSubclause($parts)
Inherited

This method is not documented.
Parameters
array$parts
Return
wild

final public function setOffset($offset)
Inherited

This method is not documented.
Parameters
$offset
Return
wild

final public function setLimit($limit)
Inherited

This method is not documented.
Parameters
$limit
Return
wild

final public function getOffset()
Inherited

This method is not documented.
Return
wild

final public function getLimit()
Inherited

This method is not documented.
Return
wild

final protected function buildLimitClause($conn)
Inherited

This method is not documented.
Parameters
AphrontDatabaseConnection$conn
Return
wild

final public function executeWithOffsetPager($pager)
Inherited

This method is not documented.
Parameters
PHUIPagerView$pager
Return
wild

final public function setViewer($viewer)
Inherited

PhabricatorPolicyAwareQuery

Set the viewer who is executing the query. Results will be filtered according to the viewer's capabilities. You must set a viewer to execute a policy query.

Parameters
PhabricatorUser$viewerThe viewing user.
Return
this

final public function getViewer()
Inherited

PhabricatorPolicyAwareQuery

Get the query's viewer.

Return
PhabricatorUserThe viewing user.

final public function setParentQuery($query)
Inherited

PhabricatorPolicyAwareQuery

Set the parent query of this query. This is useful for nested queries so that configuration like whether or not to raise policy exceptions is seamlessly passed along to child queries.

Parameters
PhabricatorPolicyAwareQuery$query
Return
this

final public function getParentQuery()
Inherited

PhabricatorPolicyAwareQuery

Get the parent query. See setParentQuery() for discussion.

Return
PhabricatorPolicyAwareQueryThe parent query.

final public function setRaisePolicyExceptions($bool)
Inherited

PhabricatorPolicyAwareQuery

Hook to configure whether this query should raise policy exceptions.

Parameters
$bool
Return
this

final public function shouldRaisePolicyExceptions()
Inherited

This method is not documented.
Return
bool

final public function requireCapabilities($capabilities)
Inherited

This method is not documented.
Parameters
array$capabilities
Return
wild

final public function setReturnPartialResultsOnOverheat($bool)
Inherited

This method is not documented.
Parameters
$bool
Return
wild

final public function setDisableOverheating($disable_overheating)
Inherited

This method is not documented.
Parameters
$disable_overheating
Return
wild

final public function executeOne()
Inherited

PhabricatorPolicyAwareQuery

Execute the query, expecting a single result. This method simplifies loading objects for detail pages or edit views.

// Load one result by ID.
$obj = id(new ExampleQuery())
  ->setViewer($user)
  ->withIDs(array($id))
  ->executeOne();
if (!$obj) {
  return new Aphront404Response();
}

If zero results match the query, this method returns null. If one result matches the query, this method returns that result.

If two or more results match the query, this method throws an exception. You should use this method only when the query constraints guarantee at most one match (e.g., selecting a specific ID or PHID).

If one result matches the query but it is caught by the policy filter (for example, the user is trying to view or edit an object which exists but which they do not have permission to see) a policy exception is thrown.

Return
mixedSingle result, or null.

private function getPolicyFilter()
Inherited

This method is not documented.
Return
wild

protected function getRequiredCapabilities()
Inherited

This method is not documented.
Return
wild

protected function applyPolicyFilter($objects, $capabilities)
Inherited

This method is not documented.
Parameters
array$objects
array$capabilities
Return
wild

protected function didRejectResult($object)
Inherited

This method is not documented.
Parameters
PhabricatorPolicyInterface$object
Return
wild

public function addPolicyFilteredPHIDs($phids)
Inherited

This method is not documented.
Parameters
array$phids
Return
wild

public function getIsOverheated()
Inherited

This method is not documented.
Return
wild

public function getPolicyFilteredPHIDs()
Inherited

PhabricatorPolicyAwareQuery

Return a map of all object PHIDs which were loaded in the query but filtered out by policy constraints. This allows a caller to distinguish between objects which do not exist (or, at least, were filtered at the content level) and objects which exist but aren't visible.

Return
map<phid, phid>Map of object PHIDs which were filtered by policies.

public function putObjectsInWorkspace($objects)
Inherited

PhabricatorPolicyAwareQuery

Put a map of objects into the query workspace. Many queries perform subqueries, which can eventually end up loading the same objects more than once (often to perform policy checks).

For example, loading a user may load the user's profile image, which might load the user object again in order to verify that the viewer has permission to see the file.

The "query workspace" allows queries to load objects from elsewhere in a query block instead of refetching them.

When using the query workspace, it's important to obey two rules:

Never put objects into the workspace which the viewer may not be able to see. You need to apply all policy filtering before putting objects in the workspace. Otherwise, subqueries may read the objects and use them to permit access to content the user shouldn't be able to view.

Fully enrich objects pulled from the workspace. After pulling objects from the workspace, you still need to load and attach any additional content the query requests. Otherwise, a query might return objects without requested content.

Generally, you do not need to update the workspace yourself: it is automatically populated as a side effect of objects surviving policy filtering.

Parameters
map<phid,$objectsPhabricatorPolicyInterface> Objects to add to the query workspace.
Return
this

public function getObjectsFromWorkspace($phids)
Inherited

PhabricatorPolicyAwareQuery

Retrieve objects from the query workspace. For more discussion about the workspace mechanism, see putObjectsInWorkspace(). This method searches both the current query's workspace and the workspaces of parent queries.

Parameters
list<phid>$phidsList of PHIDs to retrieve.
Return
this

public function putPHIDsInFlight($phids)
Inherited

PhabricatorPolicyAwareQuery

Mark PHIDs as in flight.

PHIDs which are "in flight" are actively being queried for. Using this list can prevent infinite query loops by aborting queries which cycle.

Parameters
list<phid>$phidsList of PHIDs which are now in flight.
Return
this

public function getPHIDsInFlight()
Inherited

PhabricatorPolicyAwareQuery

Get PHIDs which are currently in flight.

PHIDs which are "in flight" are actively being queried for.

Return
map<phid, phid>PHIDs currently in flight.

final protected function getRawResultLimit()
Inherited

PhabricatorPolicyAwareQuery

Get the number of results loadPage() should load. If the value is 0, loadPage() should load all available results.

Return
intThe number of results to load, or 0 for all results.

protected function willExecute()
Inherited

PhabricatorPolicyAwareQuery

Hook invoked before query execution. Generally, implementations should reset any internal cursors.

Return
void

protected function loadPage()
Inherited

PhabricatorPolicyAwareQuery

Load a raw page of results. Generally, implementations should load objects from the database. They should attempt to return the number of results hinted by getRawResultLimit().

Return
list<PhabricatorPolicyInterface>List of filterable policy objects.

final protected function nextPage($page)
Inherited

PhabricatorPolicyAwareQuery

Update internal state so that the next call to loadPage() will return new results. Generally, you should adjust a cursor position based on the provided result page.

Parameters
list<PhabricatorPolicyInterface>$pageThe current page of results.
Return
void

protected function willFilterPage($rules)

PhabricatorPolicyAwareQuery

Hook for applying a page filter prior to the privacy filter. This allows you to drop some items from the result set without creating problems with pagination or cursor updates. You can also load and attach data which is required to perform policy filtering.

Generally, you should load non-policy data and perform non-policy filtering later, in didFilterPage(). Strictly fewer objects will make it that far (so the program will load less data) and subqueries from that context can use the query workspace to further reduce query load.

This method will only be called if data is available. Implementations do not need to handle the case of no results specially.

HeraldRuleQuery
This method is not documented.
Parameters
list<wild>$pageResults from `loadPage()`.
Return
list<PhabricatorPolicyInterface>Objects for policy filtering.

protected function didFilterPage($page)
Inherited

PhabricatorPolicyAwareQuery

Hook for performing additional non-policy loading or filtering after an object has satisfied all policy checks. Generally, this means loading and attaching related data.

Subqueries executed during this phase can use the query workspace, which may improve performance or make circular policies resolvable. Data which is not necessary for policy filtering should generally be loaded here.

This callback can still filter objects (for example, if attachable data is discovered to not exist), but should not do so for policy reasons.

This method will only be called if data is available. Implementations do not need to handle the case of no results specially.

Parameters
list<wild>$pageResults from @{method:willFilterPage()}.
Return
list<PhabricatorPolicyInterface>Objects after additional non-policy processing.

protected function didFilterResults($results)
Inherited

PhabricatorPolicyAwareQuery

Hook for removing filtered results from alternate result sets. This hook will be called with any objects which were returned by the query but filtered for policy reasons. The query should remove them from any cached or partial result sets.

Parameters
list<wild>$resultsList of objects that should not be returned by alternate result mechanisms.
Return
void

final protected function didLoadResults($results)
Inherited

PhabricatorPolicyAwareQuery

Hook for applying final adjustments before results are returned. This is used by PhabricatorCursorPagedPolicyAwareQuery to reverse results that are queried during reverse paging.

Parameters
list<PhabricatorPolicyInterface>$resultsQuery results.
Return
list<PhabricatorPolicyInterface>Final results.

protected function shouldDisablePolicyFiltering()
Inherited

PhabricatorPolicyAwareQuery

Allows a subclass to disable policy filtering. This method is dangerous. It should be used only if the query loads data which has already been filtered (for example, because it wraps some other query which uses normal policy filtering).

Return
boolTrue to disable all policy filtering.

public function getQueryApplicationClass()

PhabricatorPolicyAwareQuery

If this query belongs to an application, return the application class name here. This will prevent the query from returning results if the viewer can not access the application.

If this query does not belong to an application, return null.

HeraldRuleQuery
This method is not documented.
Return
string|nullApplication class name.

public function canViewerUseQueryApplication()
Inherited

PhabricatorPolicyAwareQuery

Determine if the viewer has permission to use this query's application. For queries which aren't part of an application, this method always returns true.

Return
boolTrue if the viewer has application-level permission to execute the query.

private function applyWillFilterPageExtensions($page)
Inherited

This method is not documented.
Parameters
array$page
Return
wild

protected function newExternalCursorStringForResult($object)
Inherited

This method is not documented.
Parameters
$object
Return
wild

protected function newInternalCursorFromExternalCursor($cursor)
Inherited

This method is not documented.
Parameters
$cursor
Return
wild

final protected function throwCursorException($message)
Inherited

This method is not documented.
Parameters
$message
Return
wild

protected function applyExternalCursorConstraintsToQuery($subquery, $cursor)
Inherited

This method is not documented.
Parameters
PhabricatorCursorPagedPolicyAwareQuery$subquery
$cursor
Return
wild

protected function newPagingMapFromCursorObject($cursor, $keys)
Inherited

This method is not documented.
Parameters
PhabricatorQueryCursor$cursor
array$keys
Return
wild

protected function newPagingMapFromPartialObject($object)
Inherited

This method is not documented.
Parameters
$object
Return
wild

private function getExternalCursorStringForResult($object)
Inherited

This method is not documented.
Parameters
$object
Return
wild

final protected function getExternalCursorString()
Inherited

This method is not documented.
Return
wild

private function setExternalCursorString($external_cursor)
Inherited

This method is not documented.
Parameters
$external_cursor
Return
wild

final protected function getIsQueryOrderReversed()
Inherited

This method is not documented.
Return
wild

final protected function setIsQueryOrderReversed($is_reversed)
Inherited

This method is not documented.
Parameters
$is_reversed
Return
wild

private function getInternalCursorObject()
Inherited

This method is not documented.
Return
wild

private function setInternalCursorObject($cursor)
Inherited

This method is not documented.
Parameters
PhabricatorQueryCursor$cursor
Return
wild

private function getInternalCursorFromExternalCursor($cursor_string)
Inherited

This method is not documented.
Parameters
$cursor_string
Return
wild

private function getPagingMapFromCursorObject($cursor, $keys)
Inherited

This method is not documented.
Parameters
PhabricatorQueryCursor$cursor
array$keys
Return
wild

final public function getFerretMetadata()
Inherited

This method is not documented.
Return
wild

protected function loadStandardPage($table)
Inherited

This method is not documented.
Parameters
PhabricatorLiskDAO$table
Return
wild

protected function loadStandardPageRows($table)
Inherited

This method is not documented.
Parameters
PhabricatorLiskDAO$table
Return
wild

protected function loadStandardPageRowsWithConnection($conn, $table_name)
Inherited

This method is not documented.
Parameters
AphrontDatabaseConnection$conn
$table_name
Return
wild

protected function buildStandardPageQuery($conn, $table_name)
Inherited

This method is not documented.
Parameters
AphrontDatabaseConnection$conn
$table_name
Return
wild

protected function didLoadRawRows($rows)
Inherited

This method is not documented.
Parameters
array$rows
Return
wild

protected function shouldLimitResults()
Inherited

This method is not documented.
Return
wild

final public function newIterator()
Inherited

This method is not documented.
Return
wild

final public function executeWithCursorPager($pager)
Inherited

This method is not documented.
Parameters
AphrontCursorPagerView$pager
Return
wild

protected function getPrimaryTableAlias()

PhabricatorCursorPagedPolicyAwareQuery

Return the alias this query uses to identify the primary table.

Some automatic query constructions may need to be qualified with a table alias if the query performs joins which make column names ambiguous. If this is the case, return the alias for the primary table the query uses; generally the object table which has id and phid columns.

HeraldRuleQuery
This method is not documented.
Return
stringAlias for the primary table.

public function newResultObject()

This method is not documented.
Return
wild

protected function buildSelectClause($conn)
Inherited

This method is not documented.
Parameters
AphrontDatabaseConnection$conn
Return
wild

protected function buildSelectClauseParts($conn)
Inherited

This method is not documented.
Parameters
AphrontDatabaseConnection$conn
Return
wild

protected function buildJoinClause($conn)
Inherited

This method is not documented.
Parameters
AphrontDatabaseConnection$conn
Return
wild

protected function buildJoinClauseParts($conn)

This method is not documented.
Parameters
AphrontDatabaseConnection$conn
Return
wild

protected function buildWhereClause($conn)
Inherited

This method is not documented.
Parameters
AphrontDatabaseConnection$conn
Return
wild

protected function buildWhereClauseParts($conn)

This method is not documented.
Parameters
AphrontDatabaseConnection$conn
Return
wild

protected function buildHavingClause($conn)
Inherited

This method is not documented.
Parameters
AphrontDatabaseConnection$conn
Return
wild

protected function buildHavingClauseParts($conn)
Inherited

This method is not documented.
Parameters
AphrontDatabaseConnection$conn
Return
wild

protected function buildGroupClause($conn)
Inherited

This method is not documented.
Parameters
AphrontDatabaseConnection$conn
Return
wild

protected function shouldGroupQueryResultRows()
Inherited

This method is not documented.
Return
wild

private function buildPagingWhereClause($conn)
Inherited

This method is not documented.
Parameters
AphrontDatabaseConnection$conn
Return
wild

private function buildPagingHavingClause($conn)
Inherited

This method is not documented.
Parameters
AphrontDatabaseConnection$conn
Return
wild

private function shouldPageWithHavingClause()
Inherited

This method is not documented.
Return
wild

protected function buildPagingClause($conn)
Inherited

This method is not documented.
Parameters
AphrontDatabaseConnection$conn
Return
wild

final protected function buildPagingClauseFromMultipleColumns($conn, $columns, $options)
Inherited

PhabricatorCursorPagedPolicyAwareQuery

Simplifies the task of constructing a paging clause across multiple columns. In the general case, this looks like:

A > a OR (A = a AND B > b) OR (A = a AND B = b AND C > c)

To build a clause, specify the name, type, and value of each column to include:

$this->buildPagingClauseFromMultipleColumns(
  $conn_r,
  array(
    array(
      'table' => 't',
      'column' => 'title',
      'type' => 'string',
      'value' => $cursor->getTitle(),
      'reverse' => true,
    ),
    array(
      'table' => 't',
      'column' => 'id',
      'type' => 'int',
      'value' => $cursor->getID(),
    ),
  ),
  array(
    'reversed' => $is_reversed,
  ));

This method will then return a composable clause for inclusion in WHERE.

Parameters
AphrontDatabaseConnection$connConnection query will execute on.
list<map>$columnsColumn description dictionaries.
map$optionsAdditional construction options.
Return
stringQuery clause.

public function setOrder($order)
Inherited

PhabricatorCursorPagedPolicyAwareQuery

Select a result ordering.

This is a high-level method which selects an ordering from a predefined list of builtin orders, as provided by getBuiltinOrders(). These options are user-facing and not exhaustive, but are generally convenient and meaningful.

You can also use setOrderVector() to specify a low-level ordering across individual orderable columns. This offers greater control but is also more involved.

Parameters
string$orderKey of a builtin order supported by this query.
Return
this

public function setGroupVector($vector)
Inherited

PhabricatorCursorPagedPolicyAwareQuery

Set a grouping order to apply before primary result ordering.

This allows you to preface the query order vector with additional orders, so you can effect "group by" queries while still respecting "order by".

This is a high-level method which works alongside setOrder(). For lower-level control over order vectors, use setOrderVector().

Parameters
PhabricatorQueryOrderVector|list<string>$vectorList of order keys.
Return
this

public function getBuiltinOrders()
Inherited

PhabricatorCursorPagedPolicyAwareQuery

Get builtin orders for this class.

In application UIs, we want to be able to present users with a small selection of meaningful order options (like "Order by Title") rather than an exhaustive set of column ordering options.

Meaningful user-facing orders are often really orders across multiple columns: for example, a "title" ordering is usually implemented as a "title, id" ordering under the hood.

Builtin orders provide a mapping from convenient, understandable user-facing orders to implementations.

A builtin order should provide these keys:

  • vector (list<string>): The actual order vector to use.
  • name (string): Human-readable order name.
Return
map<string, wild>Map from builtin order keys to specification.

public function getBuiltinOrderAliasMap()
Inherited

This method is not documented.
Return
wild

public function setOrderVector($vector)
Inherited

PhabricatorCursorPagedPolicyAwareQuery

Set a low-level column ordering.

This is a low-level method which offers granular control over column ordering. In most cases, applications can more easily use setOrder() to choose a high-level builtin order.

To set an order vector, specify a list of order keys as provided by getOrderableColumns().

Parameters
PhabricatorQueryOrderVector|list<string>$vectorList of order keys.
Return
this

protected function getOrderVector()
Inherited

PhabricatorCursorPagedPolicyAwareQuery

Get the effective order vector.

Return
PhabricatorQueryOrderVectorEffective vector.

protected function getDefaultOrderVector()
Inherited

This method is not documented.
Return
wild

public function getOrderableColumns()
Inherited

This method is not documented.
Return
wild

final protected function buildOrderClause($conn, $for_union)
Inherited

This method is not documented.
Parameters
AphrontDatabaseConnection$conn
$for_union
Return
wild

private function getQueryableOrderVector()
Inherited

This method is not documented.
Return
wild

protected function formatOrderClause($conn, $parts, $for_union)
Inherited

This method is not documented.
Parameters
AphrontDatabaseConnection$conn
array$parts
$for_union
Return
wild

public function withApplicationSearchContainsConstraint($index, $value)
Inherited

PhabricatorCursorPagedPolicyAwareQuery

Constrain the query with an ApplicationSearch index, requiring field values contain at least one of the values in a set.

This constraint can build the most common types of queries, like:

  • Find users with shirt sizes "X" or "XL".
  • Find shoes with size "13".
Parameters
PhabricatorCustomFieldIndexStorage$indexTable where the index is stored.
string|list<string>$valueOne or more values to filter by.
Return
this

public function withApplicationSearchRangeConstraint($index, $min, $max)
Inherited

PhabricatorCursorPagedPolicyAwareQuery

Constrain the query with an ApplicationSearch index, requiring values exist in a given range.

This constraint is useful for expressing date ranges:

  • Find events between July 1st and July 7th.

The ends of the range are inclusive, so a $min of 3 and a $max of 5 will match fields with values 3, 4, or 5. Providing null for either end of the range will leave that end of the constraint open.

Parameters
PhabricatorCustomFieldIndexStorage$indexTable where the index is stored.
int|null$minMinimum permissible value, inclusive.
int|null$maxMaximum permissible value, inclusive.
Return
this

protected function getApplicationSearchObjectPHIDColumn($conn)
Inherited

PhabricatorCursorPagedPolicyAwareQuery

Get the name of the query's primary object PHID column, for constructing JOIN clauses. Normally (and by default) this is just "phid", but it may be something more exotic.

See getPrimaryTableAlias() if the column needs to be qualified with a table alias.

Parameters
AphrontDatabaseConnection$connConnection executing queries.
Return
PhutilQueryStringColumn name.

protected function getApplicationSearchMayJoinMultipleRows()
Inherited

PhabricatorCursorPagedPolicyAwareQuery

Determine if the JOINs built by ApplicationSearch might cause each primary object to return multiple result rows. Generally, this means the query needs an extra GROUP BY clause.

Return
boolTrue if the query may return multiple rows for each object.

protected function buildApplicationSearchGroupClause($conn)
Inherited

PhabricatorCursorPagedPolicyAwareQuery

Construct a GROUP BY clause appropriate for ApplicationSearch constraints.

Parameters
AphrontDatabaseConnection$connConnection executing the query.
Return
stringGroup clause.

protected function buildApplicationSearchJoinClause($conn)
Inherited

PhabricatorCursorPagedPolicyAwareQuery

Construct a JOIN clause appropriate for applying ApplicationSearch constraints.

Parameters
AphrontDatabaseConnection$connConnection executing the query.
Return
stringJoin clause.

protected function buildApplicationSearchWhereClause($conn)
Inherited

PhabricatorCursorPagedPolicyAwareQuery

Construct a WHERE clause appropriate for applying ApplicationSearch constraints.

Parameters
AphrontDatabaseConnection$connConnection executing the query.
Return
list<string>Where clause parts.

protected function getPagingValueMapForCustomFields($object)
Inherited

This method is not documented.
Parameters
PhabricatorCustomFieldInterface$object
Return
wild

protected function isCustomFieldOrderKey($key)
Inherited

This method is not documented.
Parameters
$key
Return
wild

public function supportsFerretEngine()
Inherited

This method is not documented.
Return
wild

public function withFerretQuery($engine, $query)
Inherited

This method is not documented.
Parameters
PhabricatorFerretEngine$engine
PhabricatorSavedQuery$query
Return
wild

public function getFerretTokens()
Inherited

This method is not documented.
Return
wild

public function withFerretConstraint($engine, $fulltext_tokens)
Inherited

This method is not documented.
Parameters
PhabricatorFerretEngine$engine
array$fulltext_tokens
Return
wild

protected function buildFerretSelectClause($conn)
Inherited

This method is not documented.
Parameters
AphrontDatabaseConnection$conn
Return
wild

protected function buildFerretJoinClause($conn)
Inherited

This method is not documented.
Parameters
AphrontDatabaseConnection$conn
Return
wild

protected function buildFerretWhereClause($conn)
Inherited

This method is not documented.
Parameters
AphrontDatabaseConnection$conn
Return
wild

protected function shouldGroupFerretResultRows()
Inherited

This method is not documented.
Return
wild

protected function withNgramsConstraint($index, $value)
Inherited

This method is not documented.
Parameters
PhabricatorSearchNgrams$index
$value
Return
wild

protected function buildNgramsJoinClause($conn)
Inherited

This method is not documented.
Parameters
AphrontDatabaseConnection$conn
Return
wild

protected function buildNgramsWhereClause($conn)
Inherited

This method is not documented.
Parameters
AphrontDatabaseConnection$conn
Return
wild

protected function shouldGroupNgramResultRows()
Inherited

This method is not documented.
Return
wild

private function getNgramEngine()
Inherited

This method is not documented.
Return
wild

public function withEdgeLogicPHIDs($edge_type, $operator, $phids)
Inherited

PhabricatorCursorPagedPolicyAwareQuery

Convenience method for specifying edge logic constraints with a list of PHIDs.

Parameters
const$edge_typeEdge constant.
const$operatorConstraint operator.
list<phid>$phidsList of PHIDs.
Return
this

public function withEdgeLogicConstraints($edge_type, $constraints)
Inherited

This method is not documented.
Parameters
$edge_type
array$constraints
Return
this

public function buildEdgeLogicSelectClause($conn)
Inherited

This method is not documented.
Parameters
AphrontDatabaseConnection$conn
Return
wild

public function buildEdgeLogicJoinClause($conn)
Inherited

This method is not documented.
Parameters
AphrontDatabaseConnection$conn
Return
wild

public function buildEdgeLogicWhereClause($conn)
Inherited

This method is not documented.
Parameters
AphrontDatabaseConnection$conn
Return
wild

public function buildEdgeLogicHavingClause($conn)
Inherited

This method is not documented.
Parameters
AphrontDatabaseConnection$conn
Return
wild

public function shouldGroupEdgeLogicResultRows()
Inherited

This method is not documented.
Return
wild

private function getEdgeLogicTableAlias($operator, $type)
Inherited

This method is not documented.
Parameters
$operator
$type
Return
wild

private function buildEdgeLogicTableAliasCount($alias)
Inherited

This method is not documented.
Parameters
$alias
Return
wild

private function buildEdgeLogicTableAliasAncestor($alias)
Inherited

This method is not documented.
Parameters
$alias
Return
wild

protected function getEdgeLogicValues($edge_types, $operators)
Inherited

PhabricatorCursorPagedPolicyAwareQuery

Select certain edge logic constraint values.

Parameters
array$edge_types
array$operators
Return
wild

private function validateEdgeLogicConstraints()
Inherited

PhabricatorCursorPagedPolicyAwareQuery

Validate edge logic constraints for the query.

Return
this

public function withSpacePHIDs($space_phids)
Inherited

PhabricatorCursorPagedPolicyAwareQuery

Constrain the query to return results from only specific Spaces.

Pass a list of Space PHIDs, or null to represent the default space. Only results in those Spaces will be returned.

Queries are always constrained to include only results from spaces the viewer has access to.

Parameters
list<phid|null>$space_phids
Return
wild

public function withSpaceIsArchived($archived)
Inherited

This method is not documented.
Parameters
$archived
Return
wild

private function buildSpacesWhereClause($conn)
Inherited

PhabricatorCursorPagedPolicyAwareQuery

Constrain the query to include only results in valid Spaces.

This method builds part of a WHERE clause which considers the spaces the viewer has access to see with any explicit constraint on spaces added by withSpacePHIDs().

Parameters
AphrontDatabaseConnection$connDatabase connection.
Return
stringPart of a WHERE clause.

private function hasFerretOrder()
Inherited

This method is not documented.
Return
wild

public function withIDs($ids)

This method is not documented.
Parameters
array$ids
Return
wild

public function withPHIDs($phids)

This method is not documented.
Parameters
array$phids
Return
wild

public function withAuthorPHIDs($author_phids)

This method is not documented.
Parameters
array$author_phids
Return
wild

public function withRuleTypes($types)

This method is not documented.
Parameters
array$types
Return
wild

public function withContentTypes($types)

This method is not documented.
Parameters
array$types
Return
wild

public function withDisabled($disabled)

This method is not documented.
Parameters
$disabled
Return
wild

public function withActive($active)

This method is not documented.
Parameters
$active
Return
wild

public function withDatasourceQuery($query)

This method is not documented.
Parameters
$query
Return
wild

public function withTriggerObjectPHIDs($phids)

This method is not documented.
Parameters
array$phids
Return
wild

public function withAffectedObjectPHIDs($phids)

This method is not documented.
Parameters
array$phids
Return
wild

public function needConditionsAndActions($need)

This method is not documented.
Parameters
$need
Return
wild

public function needAppliedToPHIDs($phids)

This method is not documented.
Parameters
array$phids
Return
wild

public function needValidateAuthors($need)

This method is not documented.
Parameters
$need
Return
wild

private function validateRuleAuthors($rules)

This method is not documented.
Parameters
array$rules
Return
wild