src/Entity/Reminder.php line 9

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ReminderRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. #[ORM\Entity(repositoryClassReminderRepository::class)]
  6. class Reminder
  7. {
  8.     #[ORM\Id]
  9.     #[ORM\GeneratedValue]
  10.     #[ORM\Column(type'integer')]
  11.     private $id;
  12.     #[ORM\ManyToOne(targetEntityCrop::class)]
  13.     private $crop;
  14.     #[ORM\ManyToOne(targetEntityCropaction::class)]
  15.     private $cropaction;
  16.     #[ORM\ManyToOne(targetEntityUser::class, inversedBy'reminders')]
  17.     #[ORM\JoinColumn(nullablefalse)]
  18.     private $user;
  19.     #[ORM\Column(type'datetime')]
  20.     private $reminderAt;
  21.     #[ORM\Column(type'json'nullabletrue)]
  22.     private $repeatpattern = [];
  23.     #[ORM\Column(type'string'length255nullabletrue)]
  24.     private $title;
  25.     #[ORM\Column(type'datetime')]
  26.     private $createdAt;
  27.     #[ORM\Column(type'datetime'nullabletrue)]
  28.     private $updatedAt;
  29.     public function __construct() {
  30.         $this->createdAt = new \DateTime();
  31.         $this->updatedAt = new \DateTime();
  32.     }
  33.     public function getId(): ?int
  34.     {
  35.         return $this->id;
  36.     }
  37.     public function getCrop(): ?Crop
  38.     {
  39.         return $this->crop;
  40.     }
  41.     public function setCrop(?Crop $crop): self
  42.     {
  43.         $this->crop $crop;
  44.         return $this;
  45.     }
  46.     public function getCropaction(): ?Cropaction
  47.     {
  48.         return $this->cropaction;
  49.     }
  50.     public function setCropaction(?Cropaction $cropaction): self
  51.     {
  52.         $this->cropaction $cropaction;
  53.         return $this;
  54.     }
  55.     public function getUser(): ?User
  56.     {
  57.         return $this->user;
  58.     }
  59.     public function setUser(?User $user): self
  60.     {
  61.         $this->user $user;
  62.         return $this;
  63.     }
  64.     public function getReminderAt(): ?\DateTimeInterface
  65.     {
  66.         return $this->reminderAt;
  67.     }
  68.     public function setReminderAt(\DateTimeInterface $reminderAt): self
  69.     {
  70.         $this->reminderAt $reminderAt;
  71.         return $this;
  72.     }
  73.     public function getRepeatpattern(): ?array
  74.     {
  75.         return $this->repeatpattern;
  76.     }
  77.     public function setRepeatpattern(?array $repeatpattern): self
  78.     {
  79.         $this->repeatpattern $repeatpattern;
  80.         return $this;
  81.     }
  82.     public function getTitle(): ?string
  83.     {
  84.         if( !empty($this->cropaction) ) {
  85.             return $this->getCropaction()->getTitle();
  86.         }
  87.         return $this->title;
  88.     }
  89.     public function setTitle(?string $title): self
  90.     {
  91.         $this->title $title;
  92.         return $this;
  93.     }
  94.     public function getCreatedAt(): ?\DateTimeInterface
  95.     {
  96.         return $this->createdAt;
  97.     }
  98.     public function setCreatedAt(\DateTimeInterface $createdAt): self
  99.     {
  100.         $this->createdAt $createdAt;
  101.         return $this;
  102.     }
  103.     public function getUpdatedAt(): ?\DateTimeInterface
  104.     {
  105.         return $this->updatedAt;
  106.     }
  107.     public function setUpdatedAt(?\DateTimeInterface $updatedAt): self
  108.     {
  109.         $this->updatedAt $updatedAt;
  110.         return $this;
  111.     }
  112. }