From a71bdfeb44b4b78ffcbf9d15eaaf7ae10f2028fd Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Wed, 25 Nov 2015 12:54:21 +0100 Subject: [PATCH] SyncRule: add listInvolvedSourceIds() method --- library/Director/Objects/SyncRule.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/library/Director/Objects/SyncRule.php b/library/Director/Objects/SyncRule.php index c384072d..66abe3a9 100644 --- a/library/Director/Objects/SyncRule.php +++ b/library/Director/Objects/SyncRule.php @@ -21,6 +21,24 @@ class SyncRule extends DbObject 'filter_expression' => null, ); + public function listInvolvedSourceIds() + { + if (! $this->hasBeenLoadedFromDb()) { + return array(); + } + + $db = $this->getDb(); + return array_map('intval', array_unique( + $db->fetchCol( + $db->select() + ->from(array('p' => 'sync_property'), 'p.source_id') + ->join(array('s' => 'import_source'), 's.id = p.source_id', array()) + ->where('rule_id = ?', $this->id) + ->order('s.source_name') + ) + )); + } + public function getPriorityForNextProperty() { if (! $this->hasBeenLoadedFromDb()) {