src/Entity/ShortUrl.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ShortUrlRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. /**
  6.  * @ORM\Entity(repositoryClass=ShortUrlRepository::class)
  7.  */
  8. class ShortUrl
  9. {
  10.     /**
  11.      * @ORM\Id()
  12.      * @ORM\GeneratedValue()
  13.      * @ORM\Column(type="integer")
  14.      */
  15.     private $id;
  16.     /**
  17.      * @ORM\Column(type="string", length=10, unique=true)
  18.      */
  19.     private $token;
  20.     /**
  21.      * @ORM\Column(type="string", length=255, nullable=true)
  22.      */
  23.     private $targetUrl;
  24.     /**
  25.      * @ORM\Column(type="datetime", nullable=true)
  26.      */
  27.     private $lastOpenedDate;
  28.     /**
  29.      * @ORM\Column(type="datetime", nullable=true)
  30.      */
  31.     private $creationDate;
  32.     /**
  33.      * @ORM\Column(type="string", length=50, nullable=true)
  34.      */
  35.     private $type;
  36.     public function getId(): ?int
  37.     {
  38.         return $this->id;
  39.     }
  40.     public function getToken(): ?string
  41.     {
  42.         return $this->token;
  43.     }
  44.     public function setToken(string $token): self
  45.     {
  46.         $this->token $token;
  47.         return $this;
  48.     }
  49.     public function getTargetUrl(): ?string
  50.     {
  51.         return $this->targetUrl;
  52.     }
  53.     public function setTargetUrl(string $targetUrl): self
  54.     {
  55.         $this->targetUrl $targetUrl;
  56.         if(!is_null($targetUrl)){
  57.             $this->setCreationDate(new \DateTime());
  58.         }
  59.         return $this;
  60.     }
  61.     public function getLastOpenedDate(): ?\DateTimeInterface
  62.     {
  63.         return $this->lastOpenedDate;
  64.     }
  65.     public function setLastOpenedDate(?\DateTimeInterface $lastOpenedDate): self
  66.     {
  67.         $this->lastOpenedDate $lastOpenedDate;
  68.         return $this;
  69.     }
  70.     public function getCreationDate(): ?\DateTimeInterface
  71.     {
  72.         return $this->creationDate;
  73.     }
  74.     public function setCreationDate(?\DateTimeInterface $creationDate): self
  75.     {
  76.         $this->creationDate $creationDate;
  77.         return $this;
  78.     }
  79.     public function getType(): ?string
  80.     {
  81.         return $this->type;
  82.     }
  83.     public function setType(?string $type): self
  84.     {
  85.         $this->type $type;
  86.         return $this;
  87.     }
  88. }