2026-03-29 08:11:30 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
namespace App\Repository;
|
|
|
|
|
|
|
|
|
|
use App\Entity\Import;
|
|
|
|
|
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
|
|
|
|
use Doctrine\Persistence\ManagerRegistry;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @extends ServiceEntityRepository<Import>
|
|
|
|
|
*/
|
|
|
|
|
class ImportRepository extends ServiceEntityRepository
|
|
|
|
|
{
|
|
|
|
|
public function __construct(ManagerRegistry $registry)
|
|
|
|
|
{
|
|
|
|
|
parent::__construct($registry, Import::class);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function incrementProcessedBatches(Import $import): int
|
|
|
|
|
{
|
|
|
|
|
return (int) $this->getEntityManager()->getConnection()->fetchOne(
|
2026-03-29 08:27:57 +00:00
|
|
|
'UPDATE import SET processed_batches = processed_batches + 1 WHERE id = :id RETURNING processed_batches',
|
2026-03-29 08:11:30 +00:00
|
|
|
['id' => $import->getId()]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function incrementFailedFilms(Import $import): void
|
|
|
|
|
{
|
|
|
|
|
$this->getEntityManager()->getConnection()->executeStatement(
|
|
|
|
|
'UPDATE import SET failed_films = failed_films + 1 WHERE id = :id',
|
|
|
|
|
['id' => $import->getId()]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|