3 final class PhabricatorSubscriptionsExportEngineExtension
4 extends PhabricatorExportEngineExtension
{
6 const EXTENSIONKEY
= 'subscriptions';
8 public function supportsObject($object) {
9 return ($object instanceof PhabricatorSubscribableInterface
);
12 public function newExportFields() {
14 id(new PhabricatorPHIDListExportField())
15 ->setKey('subscriberPHIDs')
16 ->setLabel(pht('Subscriber PHIDs')),
17 id(new PhabricatorStringListExportField())
18 ->setKey('subscribers')
19 ->setLabel(pht('Subscribers')),
23 public function newExportData(array $objects) {
24 $viewer = $this->getViewer();
26 $object_phids = mpull($objects, 'getPHID');
28 $projects_query = id(new PhabricatorEdgeQuery())
29 ->withSourcePHIDs($object_phids)
32 PhabricatorObjectHasSubscriberEdgeType
::EDGECONST
,
34 $projects_query->execute();
36 $handles = $viewer->loadHandles($projects_query->getDestinationPHIDs());
39 foreach ($objects as $object) {
40 $object_phid = $object->getPHID();
42 $project_phids = $projects_query->getDestinationPHIDs(
44 array(PhabricatorObjectHasSubscriberEdgeType
::EDGECONST
));
46 $handle_list = $handles->newSublist($project_phids);
47 $handle_list = iterator_to_array($handle_list);
48 $handle_names = mpull($handle_list, 'getName');
49 $handle_names = array_values($handle_names);
52 'subscriberPHIDs' => $project_phids,
53 'subscribers' => $handle_names,