<?php
declare(strict_types=1);
namespace App\Domains\Shared\Entity;
use App\Domains\Shared\Repository\AppVersionRepository;
use DateTimeImmutable;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: AppVersionRepository::class)]
#[ORM\Table(name: 'app_version')]
class AppVersion
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: Types::INTEGER)]
private ?int $id = null;
#[ORM\Column(type: Types::STRING, length: 20, unique: true)]
private string $version;
#[ORM\Column(type: Types::BOOLEAN)]
private bool $enabled = true;
#[ORM\Column(name: 'created_at', type: Types::DATETIME_IMMUTABLE)]
private DateTimeImmutable $createdAt;
#[ORM\Column(name: 'updated_at', type: Types::DATETIME_IMMUTABLE)]
private DateTimeImmutable $updatedAt;
public function __construct(string $version)
{
$this->version = $version;
$this->enabled = true;
$this->createdAt = new DateTimeImmutable();
$this->updatedAt = new DateTimeImmutable();
}
public function getId(): ?int
{
return $this->id;
}
public function getVersion(): string
{
return $this->version;
}
public function isEnabled(): bool
{
return $this->enabled;
}
public function setEnabled(bool $enabled): void
{
$this->enabled = $enabled;
$this->updatedAt = new DateTimeImmutable();
}
public function getCreatedAt(): DateTimeImmutable
{
return $this->createdAt;
}
public function getUpdatedAt(): DateTimeImmutable
{
return $this->updatedAt;
}
}