<?phpnamespace App\Entity;use App\Entity\Eg\Admin\User;use App\Repository\DictionaryImportRepository;use Doctrine\ORM\Mapping as ORM;#[ORM\Entity(repositoryClass: DictionaryImportRepository::class)]class DictionaryImport{ public const TYPE_ZONES_AND_STREETS = 'zones_and_streets'; public const TYPE_COUNTRIES = 'countries'; #[ORM\Id] #[ORM\GeneratedValue(strategy: 'IDENTITY')] #[ORM\Column(type: 'integer')] private $id; #[ORM\ManyToOne(targetEntity: User::class, inversedBy: 'dictionaryImports')] #[ORM\JoinColumn(nullable: false)] private $createdBy; #[ORM\Column(type: 'integer')] private $insertedRecords; #[ORM\Column(type: 'integer')] private $updatedRecords; #[ORM\Column(type: 'datetimetz_immutable')] private $createdAt; #[ORM\Column(type: 'string', length: 80)] private $type; public static function createZonesAndStreetsImport(User $user, int $insertedRecords, int $updatedRecords): self { $import = new self(); $import->setCreatedBy($user) ->setInsertedRecords($insertedRecords) ->setUpdatedRecords($updatedRecords) ->setType(self::TYPE_ZONES_AND_STREETS); return $import; } public static function createCountriesImport(User $user, int $insertedRecords, int $updatedRecords): self { $import = new self(); $import->setCreatedBy($user) ->setInsertedRecords($insertedRecords) ->setUpdatedRecords($updatedRecords) ->setType(self::TYPE_COUNTRIES); return $import; } public function __construct() { $this->createdAt = new \DateTimeImmutable(); } public function getId(): ?int { return $this->id; } public function getCreatedBy(): ?User { return $this->createdBy; } public function setCreatedBy(User $createdBy): self { $this->createdBy = $createdBy; return $this; } public function getInsertedRecords(): ?int { return $this->insertedRecords; } public function setInsertedRecords(int $insertedRecords): self { $this->insertedRecords = $insertedRecords; return $this; } public function getUpdatedRecords(): ?int { return $this->updatedRecords; } public function setUpdatedRecords(int $updatedRecords): self { $this->updatedRecords = $updatedRecords; return $this; } public function getCreatedAt(): ?\DateTimeImmutable { return $this->createdAt; } public function setCreatedAt(\DateTimeImmutable $createdAt): self { $this->createdAt = $createdAt; return $this; } public function getType(): ?string { return $this->type; } public function setType(string $type): self { if (!\in_array($type, [self::TYPE_ZONES_AND_STREETS, self::TYPE_COUNTRIES], true)) { throw new \InvalidArgumentException('Invalid import type: ' . $type); } $this->type = $type; return $this; }}