Commit 58cccbed authored by Sebastian Castro's avatar Sebastian Castro
Browse files

newsletter: fix testing email

parent 6bcb10af
......@@ -9,14 +9,14 @@ use Doctrine\ODM\MongoDB\Repository\DocumentRepository;
final class NewsRepository extends DocumentRepository
{
public function findLastPublishedNews(\DateTime $lastNewsletterSentAt)
public function findLastPublishedNews($lastNewsletterSentAt)
{
return $this->createQueryBuilder()
$qb = $this->createQueryBuilder()
->field('status')->equals(NewsStatus::PUBLISHED)
->sort('publicationDate', 'desc')
->field('publicationDate')->lte(new \DateTime())
->field('publicationDate')->gte($lastNewsletterSentAt)
->getQuery()
->execute();
->field('publicationDate')->lte(new \DateTime());
if ($lastNewsletterSentAt !== null)
$qb->field('publicationDate')->gte($lastNewsletterSentAt);
return $qb->getQuery()->execute();
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment