<?php
/*
* This file is part of the Kreno package.
*
* (c) Valentin Van Meeuwen <contact@wikub.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace App\Repository;
use App\Entity\EmailLog;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\ORM\QueryBuilder;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<EmailLog>
*
* @method EmailLog|null find($id, $lockMode = null, $lockVersion = null)
* @method EmailLog|null findOneBy(array $criteria, array $orderBy = null)
* @method EmailLog[] findAll()
* @method EmailLog[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class EmailLogRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, EmailLog::class);
}
public function add(EmailLog $entity, bool $flush = false): void
{
$this->getEntityManager()->persist($entity);
if ($flush) {
$this->getEntityManager()->flush();
}
}
public function remove(EmailLog $entity, bool $flush = false): void
{
$this->getEntityManager()->remove($entity);
if ($flush) {
$this->getEntityManager()->flush();
}
}
public function getQueryBuilder(): QueryBuilder
{
return $this->createQueryBuilder('el')
->orderBy('el.sendedAt', 'DESC')
;
}
// /**
// * @return EmailLog[] Returns an array of EmailLog objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('e')
// ->andWhere('e.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('e.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?EmailLog
// {
// return $this->createQueryBuilder('e')
// ->andWhere('e.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}