src/Entity/QuickLink.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use DateTime;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Gedmo\Timestampable\Traits\TimestampableEntity;
  6. /**
  7.  * To use in many templates
  8.  *
  9.  * @ORM\Entity
  10.  * @ORM\Entity(repositoryClass="App\Repository\QuickLinkRepository")
  11.  * @ORM\HasLifecycleCallbacks()
  12.  *
  13.  */
  14. class QuickLink implements EntityInterface
  15. {
  16.     use TimestampableEntity;
  17.     use BlameableEntity;
  18.     /**
  19.      * @var int
  20.      *
  21.      * @ORM\Column(name="id", type="integer")
  22.      * @ORM\Id
  23.      * @ORM\GeneratedValue(strategy="AUTO")
  24.      */
  25.     public $id;
  26.     /**
  27.      * @var string
  28.      * @ORM\Column(name="title", type="string", length=255)
  29.      */
  30.     private $title;
  31.     /**
  32.      * @var string
  33.      * @ORM\Column(name="description", type="string", length=255, nullable=true)
  34.      */
  35.     private $description;
  36.     /**
  37.      * @var string
  38.      * @ORM\Column(name="url", type="string", length=255, nullable=true)
  39.      */
  40.     private $url;
  41.     /**
  42.      * @var DateTime
  43.      *
  44.      * @ORM\Column(name="date", type="datetime", nullable=false)
  45.      */
  46.     private $date;
  47.     /**
  48.      * @var Event|null
  49.      * @ORM\ManyToOne(targetEntity="App\Entity\Event", inversedBy="quickLinks")
  50.      */
  51.     private $event;
  52.     /**
  53.      * @var WorldFeed|null
  54.      * @ORM\ManyToOne(targetEntity="App\Entity\WorldFeed", inversedBy="links")
  55.      */
  56.     private $worldFeed;
  57.     public function __toString()
  58.     {
  59.         return (string)$this->getTitle();
  60.     }
  61.     /**
  62.      * @return string
  63.      */
  64.     public function getTitle()
  65.     {
  66.         return $this->title;
  67.     }
  68.     /**
  69.      * @param string $title
  70.      */
  71.     public function setTitle(?string $title)
  72.     {
  73.         $this->title $title == null '' $title;
  74.     }
  75.     /**
  76.      * @ORM\PreUpdate()
  77.      * @ORM\PrePersist()
  78.      */
  79.     public function preUpdate()
  80.     {
  81.         $this->setDate(new DateTime('now'));
  82.     }
  83.     /**
  84.      * @return int
  85.      */
  86.     public function getId(): int
  87.     {
  88.         return $this->id;
  89.     }
  90.     /**
  91.      * @param int $id
  92.      */
  93.     public function setId(int $id)
  94.     {
  95.         $this->id $id;
  96.     }
  97.     /**
  98.      * @return string
  99.      */
  100.     public function getDescription()
  101.     {
  102.         return $this->description;
  103.     }
  104.     /**
  105.      * @param string $description
  106.      */
  107.     public function setDescription(string $description null)
  108.     {
  109.         $this->description $description;
  110.     }
  111.     /**
  112.      * @return DateTime
  113.      */
  114.     public function getDate(): DateTime
  115.     {
  116.         return $this->date;
  117.     }
  118.     /**
  119.      * @param DateTime $date
  120.      */
  121.     public function setDate(DateTime $date)
  122.     {
  123.         $this->date $date;
  124.     }
  125.     /**
  126.      * Get event
  127.      *
  128.      * @return Event
  129.      */
  130.     public function getEvent()
  131.     {
  132.         return $this->event;
  133.     }
  134.     /**
  135.      * Set event
  136.      *
  137.      * @param Event $event
  138.      *
  139.      * @return QuickLink
  140.      */
  141.     public function setEvent(Event $event null)
  142.     {
  143.         $this->event $event;
  144.         return $this;
  145.     }
  146.     /**
  147.      * @return Event|null
  148.      */
  149.     public function getWorldFeed(): ?WorldFeed
  150.     {
  151.         return $this->worldFeed;
  152.     }
  153.     /**
  154.      * @param WorldFeed|null $worldFeed
  155.      */
  156.     public function setWorldFeed(?WorldFeed $worldFeed): void
  157.     {
  158.         $this->worldFeed $worldFeed;
  159.     }
  160.     public function toString(): string
  161.     {
  162.         return $this->getUrl();
  163.     }
  164.     /**
  165.      * Get url
  166.      *
  167.      * @return string
  168.      */
  169.     public function getUrl()
  170.     {
  171.         return $this->url;
  172.     }
  173.     /**
  174.      * Set url
  175.      *
  176.      * @param string $url
  177.      *
  178.      * @return QuickLink
  179.      */
  180.     public function setUrl($url)
  181.     {
  182.         $this->url $url;
  183.         return $this;
  184.     }
  185. }