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; ...@@ -9,14 +9,14 @@ use Doctrine\ODM\MongoDB\Repository\DocumentRepository;
final class NewsRepository extends 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) ->field('status')->equals(NewsStatus::PUBLISHED)
->sort('publicationDate', 'desc') ->sort('publicationDate', 'desc')
->field('publicationDate')->lte(new \DateTime()) ->field('publicationDate')->lte(new \DateTime());
->field('publicationDate')->gte($lastNewsletterSentAt) if ($lastNewsletterSentAt !== null)
->getQuery() $qb->field('publicationDate')->gte($lastNewsletterSentAt);
->execute(); 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