refactor send_reminded function

This commit is contained in:
Nicolas Le Goff
2012-07-11 16:54:09 +02:00
parent d998184477
commit 66e84bcbfb
6 changed files with 81 additions and 41 deletions

View File

@@ -12,6 +12,7 @@
namespace Repositories;
use Doctrine\ORM\EntityRepository;
use Doctrine\DBAL\Types\Type;
/**
*
@@ -21,5 +22,26 @@ use Doctrine\ORM\EntityRepository;
class ValidationParticipantRepository extends EntityRepository
{
/**
* Retrieve all not reminded participants where the validation has not expired
*
* @param $expireDate The expiration Date
* @return array
*/
public function findNotConfirmedAndNotRemindedParticipantsByExpireDate(\DateTime $expireDate)
{
$dql = '
SELECT p, s
FROM Entities\ValidationParticipant p
JOIN p.session s
JOIN s.basket b
WHERE p.is_confirmed = 0
AND p.reminded IS NULL
AND s.expires < :date';
return $this->_em->createQuery($dql)
->setParameter('date', $expireDate, Type::DATETIME)
->getResult();
}
}