<?php

declare(strict_types=1);

namespace App\Domain\Media;

use App\Framework\Database\EntityManager;

final class ImageVariantRepository
{
    public function __construct(
        private EntityManager $entityManager
    ) {
    }

    public function save(ImageVariant $imageVariant): void
    {
        $this->entityManager->save($imageVariant);
    }

    public function findByFilename(string $filename): ?ImageVariant
    {
        return $this->entityManager->findOneBy(ImageVariant::class, ['filename' => $filename]);
    }
}
