Spaces:
No application file
No application file
File size: 968 Bytes
d2897cd |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
<?php
declare(strict_types=1);
namespace Mautic\PointBundle\Entity;
use Mautic\CoreBundle\Entity\CommonRepository;
/**
* @extends CommonRepository<GroupContactScore>
*/
class GroupContactScoreRepository extends CommonRepository
{
public function compareScore(int $leadId, int $groupId, int $score, string $operatorExpr): bool
{
$q = $this->_em->getConnection()->createQueryBuilder();
$q->select('lcs.contact_id')
->from(MAUTIC_TABLE_PREFIX.GroupContactScore::TABLE_NAME, 'lcs');
$expr = $q->expr()->and(
$q->expr()->eq('lcs.contact_id', ':lead'),
$q->expr()->eq('lcs.group_id', ':groupId'),
$q->expr()->$operatorExpr('lcs.score', ':score'),
);
$q->where($expr)
->setParameter('lead', $leadId)
->setParameter('groupId', $groupId)
->setParameter('score', $score);
return false !== $q->executeQuery()->fetchOne();
}
}
|