diff --git a/Model/ResourceModel/Queue.php b/Model/ResourceModel/Queue.php index bd41644e..e2c7c6ef 100644 --- a/Model/ResourceModel/Queue.php +++ b/Model/ResourceModel/Queue.php @@ -339,4 +339,24 @@ public function childIdsByEntityType($queueId, $entityType) return $this->getConnection()->fetchCol($select, ['queue_id' => $queueId, 'entity_type' => $entityType]); } + + /** + * @param array $entityIds + * @return array + */ + public function getDependentIds($entityIds) + { + $connection = $this->getConnection(); + $select = $connection->select() + ->from([ + 'relation_table' => $this->getTable('tnw_salesforce_entity_queue_relation') + ]) + ->joinLeft( + ['queue_table' => $this->getTable('tnw_salesforce_entity_queue')], + 'queue_table.queue_id = relation_table.parent_id' + ) + ->where($connection->prepareSqlCondition('queue_table .queue_id', ['in' => $entityIds])); + + return $connection->fetchCol($select); + } }