| 1: | <?php |
| 2: | namespace TIC\MailBundle\Repository; |
| 3: | |
| 4: | |
| 5: | use TIC\DormBundle\Base\TICRepository as BaseRepository; |
| 6: | use TIC\MailBundle\Entity\Maillog as Entity; |
| 7: | |
| 8: | |
| 9: | |
| 10: | |
| 11: | class MaillogRepository extends BaseRepository |
| 12: | { |
| 13: | |
| 14: | |
| 15: | |
| 16: | |
| 17: | public $sortBy = ['createdAt' => 'DESC']; |
| 18: | |
| 19: | |
| 20: | |
| 21: | |
| 22: | |
| 23: | |
| 24: | |
| 25: | |
| 26: | public function listAllByTemplate(string $ref, array $filters = []): array |
| 27: | { |
| 28: | $filters['template'] = \strtolower(\trim($ref)); |
| 29: | return $this->findBy($filters, $this->sortBy); |
| 30: | } |
| 31: | |
| 32: | |
| 33: | |
| 34: | |
| 35: | |
| 36: | |
| 37: | |
| 38: | public function createEventLog(array $data = []): int |
| 39: | { |
| 40: | $item = new Entity($data); |
| 41: | |
| 42: | $em = $this->getEntityManager(); |
| 43: | $em->persist($item); |
| 44: | $em->flush(); |
| 45: | |
| 46: | return $item->getId(); |
| 47: | } |
| 48: | |
| 49: | } |
| 50: | |