本文整理汇总了PHP中PhabricatorEdgeQuery::withSourcePHIDs方法的典型用法代码示例。如果您正苦于以下问题:PHP PhabricatorEdgeQuery::withSourcePHIDs方法的具体用法?PHP PhabricatorEdgeQuery::withSourcePHIDs怎么用?PHP PhabricatorEdgeQuery::withSourcePHIDs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhabricatorEdgeQuery
的用法示例。
在下文中一共展示了PhabricatorEdgeQuery::withSourcePHIDs方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadBloggers
private function loadBloggers(array $blogs)
{
assert_instances_of($blogs, 'PhameBlog');
$blog_phids = mpull($blogs, 'getPHID');
$edge_types = array(PhabricatorEdgeConfig::TYPE_BLOG_HAS_BLOGGER);
$query = new PhabricatorEdgeQuery();
$query->withSourcePHIDs($blog_phids)->withEdgeTypes($edge_types)->execute();
$all_blogger_phids = $query->getDestinationPHIDs($blog_phids, $edge_types);
$handles = id(new PhabricatorObjectHandleData($all_blogger_phids))->loadHandles();
foreach ($blogs as $blog) {
$blogger_phids = $query->getDestinationPHIDs(array($blog->getPHID()), $edge_types);
$blog->attachBloggers(array_select_keys($handles, $blogger_phids));
}
}
示例2: execute
public function execute()
{
$query = new PhabricatorEdgeQuery();
$edge_type = PhabricatorEdgeConfig::TYPE_OBJECT_HAS_SUBSCRIBER;
$query->withSourcePHIDs($this->objectPHIDs);
$query->withEdgeTypes(array($edge_type));
if ($this->subscriberPHIDs) {
$query->withDestinationPHIDs($this->subscriberPHIDs);
}
$edges = $query->execute();
$results = array_fill_keys($this->objectPHIDs, array());
foreach ($edges as $src => $edge_types) {
foreach ($edge_types[$edge_type] as $dst => $data) {
$results[$src][] = $dst;
}
}
return $results;
}