src/Entity/Gos/NotificationForUser.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Gos;
  3. use App\Entity\Gos\Uniqskills\Course;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Table()
  9.  * @ORM\Entity(repositoryClass="App\Repository\Gos\NotificationForUserRepository")
  10.  * @ORM\HasLifecycleCallbacks()
  11.  */
  12. class NotificationForUser
  13. {
  14.     /**
  15.      * @ORM\Id()
  16.      * @ORM\GeneratedValue()
  17.      * @ORM\Column(type="integer")
  18.      */
  19.     private $id;
  20.     /**
  21.      * @ORM\Column(type="string", length=255)
  22.      */
  23.     private $name;
  24.     /**
  25.      * @ORM\Column(type="text", nullable=true)
  26.      */
  27.     private $message;
  28.     /**
  29.      * @ORM\ManyToMany(targetEntity="App\Entity\Gos\Uniqskills\Course", inversedBy="notificationForUsers")
  30.      * @ORM\JoinTable(name="notification_for_user_course")
  31.      */
  32.     private $courses;
  33.     /**
  34.      * @ORM\ManyToOne(targetEntity="Language", inversedBy="notificationForUser")
  35.      */
  36.     private $language;
  37.     /**
  38.      * @ORM\OneToMany(targetEntity="UserNotification", mappedBy="notificationForUser")
  39.      */
  40.     private $userNotification;
  41.     /**
  42.      * @ORM\Column(type="datetime", nullable=true)
  43.      */
  44.     private $termValidity;
  45.     /**
  46.      * @ORM\Column(type="datetime", nullable=true)
  47.      */
  48.     private $publishAt;
  49.     /**
  50.      * @ORM\Column(type="datetime")
  51.      */
  52.     private $createdAt;
  53.     /**
  54.      * @ORM\Column(type="datetime", nullable=true)
  55.      */
  56.     private $updatedAt;
  57.     /**
  58.      * @ORM\ManyToOne(targetEntity=PortalSettings::class)
  59.      */
  60.     private $portalSettings;
  61.     public function __construct()
  62.     {
  63.         $this->userNotification = new ArrayCollection();
  64.         $this->courses = new ArrayCollection();
  65.     }
  66.     /** @ORM\PrePersist() */
  67.     public function onPrePersist()
  68.     {
  69.         $this->createdAt = new \DateTime();
  70.     }
  71.     /** @ORM\PreUpdate() */
  72.     public function onPreUpdate()
  73.     {
  74.         $this->updatedAt = new \DateTime();
  75.     }
  76.     public function __toString()
  77.     {
  78.         return $this->name;
  79.     }
  80.     public function getId(): ?int
  81.     {
  82.         return $this->id;
  83.     }
  84.     public function getName(): ?string
  85.     {
  86.         return $this->name;
  87.     }
  88.     public function setName(string $name): self
  89.     {
  90.         $this->name $name;
  91.         return $this;
  92.     }
  93.     public function getMessage(): ?string
  94.     {
  95.         return $this->message;
  96.     }
  97.     public function setMessage(?string $message): self
  98.     {
  99.         $this->message $message;
  100.         return $this;
  101.     }
  102.     public function getCourses(): Collection
  103.     {
  104.         return $this->courses;
  105.     }
  106.     public function addCourses(Course $course): self
  107.     {
  108.         if (!$this->courses->contains($course)) {
  109.             $this->courses[] = $course;
  110.         }
  111.         return $this;
  112.     }
  113.     public function removeCourses(Course $course): self
  114.     {
  115.         if ($this->courses->contains($course)) {
  116.             $this->courses->removeElement($course);
  117.         }
  118.         return $this;
  119.     }
  120.     public function getLanguage(): ?Language
  121.     {
  122.         return $this->language;
  123.     }
  124.     public function setLanguage(?Language $language): self
  125.     {
  126.         $this->language $language;
  127.         return $this;
  128.     }
  129.     public function getUserNotification(): ?UserNotification
  130.     {
  131.         return $this->userNotification;
  132.     }
  133.     public function addUserNotification(UserNotification $userNotification): self
  134.     {
  135.         if (!$this->userNotification->contains($userNotification)) {
  136.             $this->userNotification[] = $userNotification;
  137.             $userNotification->setUser($this);
  138.         }
  139.         return $this;
  140.     }
  141.     public function removeUserNotification(userNotification $userNotification): self
  142.     {
  143.         if ($this->userNotification->contains($userNotification)) {
  144.             $this->userNotification->removeElement($userNotification);
  145.             if ($userNotification->getUser() === $this) {
  146.                 $userNotification->setUser(null);
  147.             }
  148.         }
  149.         return $this;
  150.     }
  151.     public function getTermValidity(): ?\DateTimeInterface
  152.     {
  153.         return $this->termValidity;
  154.     }
  155.     public function setTermValidity(?\DateTimeInterface $termValidity): self
  156.     {
  157.         $this->termValidity $termValidity;
  158.         return $this;
  159.     }
  160.     public function getPublishAt(): ?\DateTimeInterface
  161.     {
  162.         return $this->publishAt;
  163.     }
  164.     public function setPublishAt(?\DateTimeInterface $publishAt): self
  165.     {
  166.         $this->publishAt $publishAt;
  167.         return $this;
  168.     }
  169.     public function getCreatedAt(): ?\DateTimeInterface
  170.     {
  171.         return $this->createdAt;
  172.     }
  173.     public function setCreatedAt(\DateTimeInterface $createdAt): self
  174.     {
  175.         $this->createdAt $createdAt;
  176.         return $this;
  177.     }
  178.     public function getUpdatedAt(): ?\DateTimeInterface
  179.     {
  180.         return $this->updatedAt;
  181.     }
  182.     public function setUpdatedAt(?\DateTimeInterface $updatedAt): self
  183.     {
  184.         $this->updatedAt $updatedAt;
  185.         return $this;
  186.     }
  187.     public function getPortalSettings(): ?PortalSettings
  188.     {
  189.         return $this->portalSettings;
  190.     }
  191.     public function setPortalSettings(?PortalSettings $portalSettings): self
  192.     {
  193.         $this->portalSettings $portalSettings;
  194.         return $this;
  195.     }
  196. }