Replace batch-level progress (processedBatches/totalBatches) with film-level progress (processedFilms/totalFilms) for smoother UI updates. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
140 lines
2.9 KiB
PHP
140 lines
2.9 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Entity;
|
|
|
|
use App\Repository\ImportRepository;
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
|
|
#[ORM\Entity(repositoryClass: ImportRepository::class)]
|
|
class Import
|
|
{
|
|
public const string STATUS_PENDING = 'pending';
|
|
public const string STATUS_PROCESSING = 'processing';
|
|
public const string STATUS_COMPLETED = 'completed';
|
|
public const string STATUS_FAILED = 'failed';
|
|
|
|
#[ORM\Id]
|
|
#[ORM\GeneratedValue]
|
|
#[ORM\Column]
|
|
private ?int $id = null;
|
|
|
|
#[ORM\ManyToOne(targetEntity: User::class)]
|
|
#[ORM\JoinColumn(nullable: false)]
|
|
private ?User $user = null;
|
|
|
|
#[ORM\Column(length: 255)]
|
|
private ?string $filePath = null;
|
|
|
|
#[ORM\Column(length: 20)]
|
|
private string $status = self::STATUS_PENDING;
|
|
|
|
#[ORM\Column]
|
|
private int $totalFilms = 0;
|
|
|
|
#[ORM\Column]
|
|
private int $processedFilms = 0;
|
|
|
|
#[ORM\Column]
|
|
private int $failedFilms = 0;
|
|
|
|
#[ORM\Column]
|
|
private \DateTimeImmutable $createdAt;
|
|
|
|
#[ORM\Column(nullable: true)]
|
|
private ?\DateTimeImmutable $completedAt = null;
|
|
|
|
public function __construct()
|
|
{
|
|
$this->createdAt = new \DateTimeImmutable();
|
|
}
|
|
|
|
public function getId(): ?int
|
|
{
|
|
return $this->id;
|
|
}
|
|
|
|
public function getUser(): ?User
|
|
{
|
|
return $this->user;
|
|
}
|
|
|
|
public function setUser(?User $user): static
|
|
{
|
|
$this->user = $user;
|
|
return $this;
|
|
}
|
|
|
|
public function getFilePath(): ?string
|
|
{
|
|
return $this->filePath;
|
|
}
|
|
|
|
public function setFilePath(string $filePath): static
|
|
{
|
|
$this->filePath = $filePath;
|
|
return $this;
|
|
}
|
|
|
|
public function getStatus(): string
|
|
{
|
|
return $this->status;
|
|
}
|
|
|
|
public function setStatus(string $status): static
|
|
{
|
|
$this->status = $status;
|
|
return $this;
|
|
}
|
|
|
|
public function getProcessedFilms(): int
|
|
{
|
|
return $this->processedFilms;
|
|
}
|
|
|
|
public function setProcessedFilms(int $processedFilms): static
|
|
{
|
|
$this->processedFilms = $processedFilms;
|
|
return $this;
|
|
}
|
|
|
|
public function getTotalFilms(): int
|
|
{
|
|
return $this->totalFilms;
|
|
}
|
|
|
|
public function setTotalFilms(int $totalFilms): static
|
|
{
|
|
$this->totalFilms = $totalFilms;
|
|
return $this;
|
|
}
|
|
|
|
public function getFailedFilms(): int
|
|
{
|
|
return $this->failedFilms;
|
|
}
|
|
|
|
public function setFailedFilms(int $failedFilms): static
|
|
{
|
|
$this->failedFilms = $failedFilms;
|
|
return $this;
|
|
}
|
|
|
|
public function getCreatedAt(): \DateTimeImmutable
|
|
{
|
|
return $this->createdAt;
|
|
}
|
|
|
|
public function getCompletedAt(): ?\DateTimeImmutable
|
|
{
|
|
return $this->completedAt;
|
|
}
|
|
|
|
public function setCompletedAt(?\DateTimeImmutable $completedAt): static
|
|
{
|
|
$this->completedAt = $completedAt;
|
|
return $this;
|
|
}
|
|
}
|