Skip to content
Snippets Groups Projects
Commit 58cccbed authored by Sebastian Castro's avatar Sebastian Castro
Browse files

newsletter: fix testing email

parent 6bcb10af
No related branches found
Tags v2.4.8
No related merge requests found
...@@ -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();
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment