src/Entity/Cropaction.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Translation\AutoTranslatableTrait;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Knp\DoctrineBehaviors\Contract\Entity\TranslatableInterface;
  6. #[ORM\Table(name'cropaction')]
  7. #[ORM\Entity(repositoryClass'App\Entity\Repository\CropactionRepository')]
  8. class Cropaction implements TranslatableInterface
  9. {
  10.     use AutoTranslatableTrait;
  11.     #[ORM\Id]
  12.     #[ORM\Column(type'integer')]
  13.     #[ORM\GeneratedValue(strategy'AUTO')]
  14.     private $id;
  15.     #[ORM\Column(type'integer'nullabletrue)]
  16.     private $days_start;
  17.     #[ORM\Column(type'integer'nullabletrue)]
  18.     private $days_end;
  19.     #[ORM\Column(type'integer'nullabletrue)]
  20.     private $repeat_days;
  21.     #[ORM\Column(type'string'nullabletrue)]
  22.     private $title;
  23.     #[ORM\Column(type'string'nullabletrue)]
  24.     private $type;
  25.     #[ORM\Column(type'text'nullabletrue)]
  26.     private $text;
  27.     #[ORM\Column(type'text'nullabletrue)]
  28.     private $notification_text;
  29.     #[ORM\Column(type'json'nullabletrue)]
  30.     private $additional_data;
  31.     #[ORM\Column(type'datetime'nullabletrue)]
  32.     private $date_created;
  33.     #[ORM\Column(type'integer'nullabletrue)]
  34.     private $priority;
  35.     #[ORM\ManyToOne(targetEntity'App\Entity\Crop'inversedBy'cropaction')]
  36.     #[ORM\JoinColumn(name'crop_id'referencedColumnName'id'nullablefalse)]
  37.     private $crop;
  38.     #[ORM\ManyToOne(targetEntity'App\Entity\User'inversedBy'cropaction')]
  39.     #[ORM\JoinColumn(name'user_id'referencedColumnName'id')]
  40.     private $user;
  41.     #[ORM\Column(type'datetime'nullabletrue)]
  42.     private $date_updated;
  43.     public function getId(): ?int
  44.     {
  45.         return $this->id;
  46.     }
  47.     public function getTitle(): ?string
  48.     {
  49.         if ($this->getCurrentLocale() === $this->getDefaultLocale()) {
  50.             return $this->title;
  51.         }
  52.         $translated $this->translate()->getTitle();
  53.         return !empty($translated) ? $translated $this->title;
  54.     }
  55.     public function setTitle(?string $title): self
  56.     {
  57.         $this->title $title;
  58.         return $this;
  59.     }
  60.     public function getText(): ?string
  61.     {
  62.         if ($this->getCurrentLocale() === $this->getDefaultLocale()) {
  63.             return $this->text;
  64.         }
  65.         $translated $this->translate()->getText();
  66.         return !empty($translated) ? $translated $this->text;
  67.     }
  68.     public function setText(?string $text): self
  69.     {
  70.         $this->text $text;
  71.         return $this;
  72.     }
  73.     public function getDateCreated(): ?\DateTimeInterface
  74.     {
  75.         return $this->date_created;
  76.     }
  77.     public function setDateCreated(?\DateTimeInterface $date_created): self
  78.     {
  79.         $this->date_created $date_created;
  80.         return $this;
  81.     }
  82.     public function getCrop(): ?Crop
  83.     {
  84.         return $this->crop;
  85.     }
  86.     public function setCrop(?Crop $crop): self
  87.     {
  88.         $this->crop $crop;
  89.         return $this;
  90.     }
  91.     public function getRepeatDays(): ?int
  92.     {
  93.         return $this->repeat_days;
  94.     }
  95.     public function setRepeatDays(?int $repeat_days): self
  96.     {
  97.         $this->repeat_days $repeat_days;
  98.         return $this;
  99.     }
  100.     public function getAdditionalData()
  101.     {
  102.         if ($this->getCurrentLocale() === $this->getDefaultLocale()) {
  103.             return $this->additional_data;
  104.         }
  105.         $translated $this->translate()->getAdditionalData();
  106.         return !empty($translated) ? $translated $this->additional_data;
  107.     }
  108.     public function setAdditionalData($additional_data): self
  109.     {
  110.         $this->additional_data $additional_data;
  111.         return $this;
  112.     }
  113.     public function getNotificationText(): ?string
  114.     {
  115.         if ($this->getCurrentLocale() === $this->getDefaultLocale()) {
  116.             return $this->notification_text;
  117.         }
  118.         $translated $this->translate()->getNotificationText();
  119.         return !empty($translated) ? $translated $this->notification_text;
  120.     }
  121.     public function setNotificationText(?string $notification_text): self
  122.     {
  123.         $this->notification_text $notification_text;
  124.         return $this;
  125.     }
  126.     public function getDaysStart(): ?int
  127.     {
  128.         return $this->days_start;
  129.     }
  130.     public function setDaysStart(?int $days_start): self
  131.     {
  132.         $this->days_start $days_start;
  133.         return $this;
  134.     }
  135.     public function getDaysEnd(): ?int
  136.     {
  137.         return $this->days_end;
  138.     }
  139.     public function setDaysEnd(?int $days_end): self
  140.     {
  141.         $this->days_end $days_end;
  142.         return $this;
  143.     }
  144.     public function getPriority(): ?int
  145.     {
  146.         return $this->priority;
  147.     }
  148.     public function setPriority(?int $priority): self
  149.     {
  150.         $this->priority $priority;
  151.         return $this;
  152.     }
  153.     public function getUser(): ?User
  154.     {
  155.         return $this->user;
  156.     }
  157.     public function setUser(?User $user): self
  158.     {
  159.         $this->user $user;
  160.         return $this;
  161.     }
  162.     public function getType(): ?string
  163.     {
  164.         return $this->type;
  165.     }
  166.     public function setType(?string $type): self
  167.     {
  168.         $this->type $type;
  169.         return $this;
  170.     }
  171.     public function getDateUpdated(): ?\DateTimeInterface
  172.     {
  173.         return $this->date_updated;
  174.     }
  175.     public function setDateUpdated(?\DateTimeInterface $date_updated): self
  176.     {
  177.         $this->date_updated $date_updated;
  178.         return $this;
  179.     }
  180.     public function moveDaysBy(int $days): self
  181.     {
  182.         $this->days_start += $days;
  183.         if ($this->days_end !== null) {
  184.             $this->days_end += $days;
  185.         }
  186.         return $this;
  187.     }
  188.     public function scaleDaysBy(float $scale): self
  189.     {
  190.         $this->days_start round($this->days_start $scale);
  191.         if ($this->days_end !== null) {
  192.             $this->days_end round($this->days_end $scale);
  193.         }
  194.         return $this;
  195.     }
  196. }