Skip to content

Commit 8c30475

Browse files
Update app/bundles/LeadBundle/Entity/LeadRepository.php
Co-authored-by: Rahul Shinde <shinde.r.a@gmail.com>
1 parent 1fee58c commit 8c30475

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

app/bundles/LeadBundle/Entity/LeadRepository.php

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -944,22 +944,15 @@ protected function addSearchCommandWhereClause($q, $filter): array
944944
case $this->translator->trans('mautic.lead.lead.searchcommand.dnc', [], null, 'en_US'):
945945
$anyKeyword = $this->translator->trans('mautic.lead.lead.searchcommand.dnc.any');
946946
$anyKeywordEn = $this->translator->trans('mautic.lead.lead.searchcommand.dnc.any', [], null, 'en_US');
947+
$sq = $this->getEntityManager()->getConnection()->createQueryBuilder();
948+
$sq->select('1')
949+
->from(MAUTIC_TABLE_PREFIX . 'lead_donotcontact', 'dnc')
950+
->where($q->expr()->eq('l.id', 'dnc.lead_id'));
951+
947952
if ($string === $anyKeyword || $string === $anyKeywordEn) {
948-
$sq = $this->getEntityManager()->getConnection()->createQueryBuilder();
949-
$sq->select('1')
950-
->from(MAUTIC_TABLE_PREFIX.'lead_donotcontact', 'dnc')
951-
->where($q->expr()->eq('l.id', 'dnc.lead_id'));
952953
$returnParameter = false;
953954
} else {
954-
$sq = $this->getEntityManager()->getConnection()->createQueryBuilder();
955-
$sq->select('1')
956-
->from(MAUTIC_TABLE_PREFIX.'lead_donotcontact', 'dnc')
957-
->where(
958-
$q->expr()->and(
959-
$q->expr()->eq('l.id', 'dnc.lead_id'),
960-
$q->expr()->eq('dnc.channel', ":$unique")
961-
)
962-
);
955+
$sq->andWhere($q->expr()->eq('dnc.channel', ":$unique"));
963956
$returnParameter = true;
964957
}
965958
$expr = $q->expr()->{$filter->not ? 'notExists' : 'exists'}($sq->getSQL());

0 commit comments

Comments
 (0)