src/Domains/Shared/Entity/AppVersion.php line 14

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Domains\Shared\Entity;
  4. use App\Domains\Shared\Repository\AppVersionRepository;
  5. use DateTimeImmutable;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. #[ORM\Entity(repositoryClassAppVersionRepository::class)]
  9. #[ORM\Table(name'app_version')]
  10. class AppVersion
  11. {
  12.     #[ORM\Id]
  13.     #[ORM\GeneratedValue]
  14.     #[ORM\Column(typeTypes::INTEGER)]
  15.     private ?int $id null;
  16.     #[ORM\Column(typeTypes::STRINGlength20uniquetrue)]
  17.     private string $version;
  18.     #[ORM\Column(typeTypes::BOOLEAN)]
  19.     private bool $enabled true;
  20.     #[ORM\Column(name'created_at'typeTypes::DATETIME_IMMUTABLE)]
  21.     private DateTimeImmutable $createdAt;
  22.     #[ORM\Column(name'updated_at'typeTypes::DATETIME_IMMUTABLE)]
  23.     private DateTimeImmutable $updatedAt;
  24.     public function __construct(string $version)
  25.     {
  26.         $this->version $version;
  27.         $this->enabled true;
  28.         $this->createdAt = new DateTimeImmutable();
  29.         $this->updatedAt = new DateTimeImmutable();
  30.     }
  31.     public function getId(): ?int
  32.     {
  33.         return $this->id;
  34.     }
  35.     public function getVersion(): string
  36.     {
  37.         return $this->version;
  38.     }
  39.     public function isEnabled(): bool
  40.     {
  41.         return $this->enabled;
  42.     }
  43.     public function setEnabled(bool $enabled): void
  44.     {
  45.         $this->enabled $enabled;
  46.         $this->updatedAt = new DateTimeImmutable();
  47.     }
  48.     public function getCreatedAt(): DateTimeImmutable
  49.     {
  50.         return $this->createdAt;
  51.     }
  52.     public function getUpdatedAt(): DateTimeImmutable
  53.     {
  54.         return $this->updatedAt;
  55.     }
  56. }