<?phpnamespace App\Entity;use App\Repository\ShortUrlRepository;use Doctrine\ORM\Mapping as ORM;/** * @ORM\Entity(repositoryClass=ShortUrlRepository::class) */class ShortUrl{ /** * @ORM\Id() * @ORM\GeneratedValue() * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="string", length=10, unique=true) */ private $token; /** * @ORM\Column(type="string", length=255, nullable=true) */ private $targetUrl; /** * @ORM\Column(type="datetime", nullable=true) */ private $lastOpenedDate; /** * @ORM\Column(type="datetime", nullable=true) */ private $creationDate; /** * @ORM\Column(type="string", length=50, nullable=true) */ private $type; public function getId(): ?int { return $this->id; } public function getToken(): ?string { return $this->token; } public function setToken(string $token): self { $this->token = $token; return $this; } public function getTargetUrl(): ?string { return $this->targetUrl; } public function setTargetUrl(string $targetUrl): self { $this->targetUrl = $targetUrl; if(!is_null($targetUrl)){ $this->setCreationDate(new \DateTime()); } return $this; } public function getLastOpenedDate(): ?\DateTimeInterface { return $this->lastOpenedDate; } public function setLastOpenedDate(?\DateTimeInterface $lastOpenedDate): self { $this->lastOpenedDate = $lastOpenedDate; return $this; } public function getCreationDate(): ?\DateTimeInterface { return $this->creationDate; } public function setCreationDate(?\DateTimeInterface $creationDate): self { $this->creationDate = $creationDate; return $this; } public function getType(): ?string { return $this->type; } public function setType(?string $type): self { $this->type = $type; return $this; }}