[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/infrastructure/edges/query/ -> PhabricatorEdgeQuery.php (summary)

Load object edges created by @{class:PhabricatorEdgeEditor}. name=Querying Edges $src  = $earth_phid; $type = PhabricatorEdgeConfig::TYPE_BODY_HAS_SATELLITE;

File Size: 331 lines (9 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 11 functions

  withSourcePHIDs()
  withDestinationPHIDs()
  withEdgeTypes()
  setOrder()
  needEdgeData()
  loadDestinationPHIDs()
  loadSingleEdgeData()
  execute()
  getDestinationPHIDs()
  buildWhereClause()
  buildOrderClause()

Functions
Functions that are not part of a class:

withSourcePHIDs(array $source_phids)   X-Ref
Find edges originating at one or more source PHIDs. You MUST provide this
to execute an edge query.

param: list List of source PHIDs.
return: this

withDestinationPHIDs(array $dest_phids)   X-Ref
Find edges terminating at one or more destination PHIDs.

param: list List of destination PHIDs.
return: this

withEdgeTypes(array $types)   X-Ref
Find edges of specific types.

param: list List of PhabricatorEdgeConfig type constants.
return: this

setOrder($order)   X-Ref
Configure the order edge results are returned in.

param: const Order constant.
return: this

needEdgeData($need)   X-Ref
When loading edges, also load edge data.

param: bool True to load edge data.
return: this

loadDestinationPHIDs($src_phid, $edge_type)   X-Ref
Convenience method for loading destination PHIDs with one source and one
edge type. Equivalent to building a full query, but simplifies a common
use case.

param: phid  Source PHID.
param: const Edge type.
return: list<phid> List of destination PHIDs.

loadSingleEdgeData($src_phid, $edge_type, $dest_phid)   X-Ref
Convenience method for loading a single edge's metadata for
a given source, destination, and edge type. Returns null
if the edge does not exist or does not have metadata. Builds
and immediately executes a full query.

param: phid  Source PHID.
param: const Edge type.
param: phid  Destination PHID.
return: wild Edge annotation (or null).

execute()   X-Ref
Load specified edges.


getDestinationPHIDs(array $src_phids = array()   X-Ref
Convenience function for selecting edge destination PHIDs after calling
execute().

Returns a flat list of PHIDs matching the provided source PHID and type
filters. By default, the filters are empty so all PHIDs will be returned.
For example, if you're doing a batch query from several sources, you might
write code like this:

$query = new PhabricatorEdgeQuery();
$query->setViewer($viewer);
$query->withSourcePHIDs(mpull($objects, 'getPHID'));
$query->withEdgeTypes(array($some_type));
$query->execute();

// Gets all of the destinations.
$all_phids = $query->getDestinationPHIDs();
$handles = id(new PhabricatorHandleQuery())
->setViewer($viewer)
->withPHIDs($all_phids)
->execute();

foreach ($objects as $object) {
// Get all of the destinations for the given object.
$dst_phids = $query->getDestinationPHIDs(array($object->getPHID()));
$object->attachHandles(array_select_keys($handles, $dst_phids));
}

param: list? List of PHIDs to select, or empty to select all.
param: list? List of edge types to select, or empty to select all.
return: list<phid> List of matching destination PHIDs.

buildWhereClause($conn_r)   X-Ref


buildOrderClause($conn_r)   X-Ref




Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1