Files
myep-team/src/Entity/License.php
T

106 lines
2.2 KiB
PHP

<?php
namespace App\Entity;
use App\Entity\Traits\TimestampableEntity;
use App\Repository\LicenseRepository;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Uid\Uuid;
use Symfony\Component\Validator\Constraints as Assert;
#[ORM\Entity(repositoryClass: LicenseRepository::class)]
class License implements TimestampableEntityInterface
{
use TimestampableEntity;
public const TYPE_SKI = 'ski';
public const TYPE_SNOWBOARD = 'snowboard';
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(type: 'string', length: 36, unique: true)]
private string $uuid;
#[ORM\Column(length: 64)]
private ?string $type;
#[ORM\Column(type: Types::DATE_IMMUTABLE)]
#[Assert\NotNull(message: 'Bitte gib das Datum an')]
private ?\DateTimeImmutable $date = null;
#[ORM\OneToOne(cascade: ['persist', 'remove'])]
#[Assert\NotNull(message: 'Bitte lade den Nachweis hoch')]
private ?Upload $certificate = null;
#[ORM\ManyToOne(inversedBy: 'licenses')]
private ?Teamer $teamer = null;
public function __construct()
{
$this->uuid = Uuid::v4();
$this->type = static::TYPE_SKI;
}
public function getId(): ?int
{
return $this->id;
}
public function getUuid(): string
{
return $this->uuid;
}
public function getType(): ?string
{
return $this->type;
}
public function setType(string $type): static
{
$this->type = $type;
return $this;
}
public function getDate(): ?\DateTimeImmutable
{
return $this->date;
}
public function setDate(\DateTimeImmutable $date): static
{
$this->date = $date;
return $this;
}
public function getCertificate(): ?Upload
{
return $this->certificate;
}
public function setCertificate(?Upload $certificate): static
{
$this->certificate = $certificate;
return $this;
}
public function getTeamer(): ?Teamer
{
return $this->teamer;
}
public function setTeamer(?Teamer $teamer): static
{
$this->teamer = $teamer;
return $this;
}
}