ApiKeyAuthenticator, PermissionVoter and UserProvider implement Symfony Security for the API (Bearer token) and admin (session) flows. Domain repository interfaces added for ApiKey, User, AIPipelineJob and Invoice; Doctrine implementations provided. Also adds DatabaseLogHandler for structured DB logging, SerpApiWebSearch, and the LogEntry domain entity. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
33 lines
862 B
PHP
33 lines
862 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Infrastructure\Persistence\Repository;
|
|
|
|
use App\Domain\Order\Invoice;
|
|
use App\Domain\Order\Repository\InvoiceRepositoryInterface;
|
|
use Doctrine\ORM\EntityManagerInterface;
|
|
use Symfony\Component\Uid\Uuid;
|
|
|
|
final class DoctrineInvoiceRepository implements InvoiceRepositoryInterface
|
|
{
|
|
public function __construct(private readonly EntityManagerInterface $em)
|
|
{
|
|
}
|
|
|
|
public function findById(Uuid $id): ?Invoice
|
|
{
|
|
return $this->em->find(Invoice::class, $id);
|
|
}
|
|
|
|
public function findByFrappeInvoiceId(string $frappeInvoiceId): ?Invoice
|
|
{
|
|
return $this->em->getRepository(Invoice::class)->findOneBy(['frappeInvoiceId' => $frappeInvoiceId]);
|
|
}
|
|
|
|
public function save(Invoice $invoice): void
|
|
{
|
|
$this->em->persist($invoice);
|
|
$this->em->flush();
|
|
}
|
|
}
|