task: adds event log module

This commit is contained in:
Brock H Caldwell
2025-11-01 15:27:21 -05:00
parent f5732fbcea
commit 6fbd56c952
9 changed files with 259 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
<?php
namespace App\EventLog\Framework\Repository;
use App\EventLog\Framework\Entity\EventLog;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<EventLog>
*/
class EventLogRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, EventLog::class);
}
public function insert(
string $type,
string $message,
array $context = []
): EventLog {
$eventLog = new EventLog()
->setType($type)
->setMessage($message)
->setContext($context);
$this->getEntityManager()->persist($eventLog);
$this->getEntityManager()->flush();
return $eventLog;
}
}