3 final class HeraldRuleIndexEngineExtension
4 extends PhabricatorEdgeIndexEngineExtension
{
6 const EXTENSIONKEY
= 'herald.actions';
8 public function getExtensionName() {
9 return pht('Herald Actions');
12 public function shouldIndexObject($object) {
13 if (!($object instanceof HeraldRule
)) {
20 protected function getIndexEdgeType() {
21 return HeraldRuleActionAffectsObjectEdgeType
::EDGECONST
;
24 protected function getIndexDestinationPHIDs($object) {
27 $viewer = $this->getViewer();
29 $rule = id(new HeraldRuleQuery())
31 ->withIDs(array($rule->getID()))
32 ->needConditionsAndActions(true)
40 $fields = HeraldField
::getAllFields();
41 foreach ($rule->getConditions() as $condition_record) {
42 $field = idx($fields, $condition_record->getFieldName());
48 $affected_phids = $field->getPHIDsAffectedByCondition($condition_record);
49 foreach ($affected_phids as $phid) {
54 $actions = HeraldAction
::getAllActions();
55 foreach ($rule->getActions() as $action_record) {
56 $action = idx($actions, $action_record->getAction());
62 foreach ($action->getPHIDsAffectedByAction($action_record) as $phid) {
67 $phids = array_fuse($phids);
68 return array_keys($phids);