Fix removing from not default segments

[MAILPOET-3378]
This commit is contained in:
Jan Lysý
2021-02-05 10:59:07 +01:00
committed by Veljko V
parent 32959b55b8
commit 0e1f7993b2

View File

@ -161,10 +161,15 @@ class SubscribersRepository extends Repository {
}
$subscriberSegmentsTable = $this->entityManager->getClassMetadata(SubscriberSegmentEntity::class)->getTableName();
$segmentsTable = $this->entityManager->getClassMetadata(SegmentEntity::class)->getTableName();
$count = $this->entityManager->getConnection()->executeUpdate("
DELETE ss FROM $subscriberSegmentsTable ss
JOIN $segmentsTable s ON s.id = ss.segment_id AND s.`type` = :typeDefault
WHERE ss.`subscriber_id` IN (:ids)
", ['ids' => $ids], ['ids' => Connection::PARAM_INT_ARRAY]);
", [
'ids' => $ids,
'typeDefault' => SegmentEntity::TYPE_DEFAULT,
], ['ids' => Connection::PARAM_INT_ARRAY]);
return $count;
}