src/Entity/CropEdit.php line 9

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. #[ORM\Table(name'crop_edit')]
  5. #[ORM\Entity(repositoryClass'App\Entity\Repository\CropEditRepository')]
  6. class CropEdit
  7. {
  8.     #[ORM\Id]
  9.     #[ORM\Column(type'integer')]
  10.     #[ORM\GeneratedValue(strategy'AUTO')]
  11.     private $id;
  12.     #[ORM\Column(type'json'nullabletrue)]
  13.     private $suggested_edit;
  14.     #[ORM\Column(type'datetime'nullabletrue)]
  15.     private $date_applied;
  16.     #[ORM\Column(type'boolean'nullabletrue)]
  17.     private $created_by_alphabeet;
  18.     #[ORM\Column(type'integer'nullabletrue)]
  19.     private $needs_moderator;
  20.     #[ORM\Column(type'datetime'nullabletrue)]
  21.     private $date_read;
  22.     #[ORM\Column(type'datetime'nullabletrue)]
  23.     private $date_created;
  24.     #[ORM\Column(type'string'nullabletrue)]
  25.     private $feedback;
  26.     #[ORM\Column(type'boolean'nullabletrue)]
  27.     private $declined;
  28.     #[ORM\ManyToOne(targetEntity'App\Entity\Crop'inversedBy'cropEdit')]
  29.     #[ORM\JoinColumn(name'crop_id'referencedColumnName'id')]
  30.     private $crop;
  31.     #[ORM\ManyToOne(targetEntity'App\Entity\User'inversedBy'cropEdit')]
  32.     #[ORM\JoinColumn(name'user_id'referencedColumnName'id')]
  33.     private $user;
  34.     #[ORM\Column(length10nullabletrue)]
  35.     private ?string $locale null;
  36.     #[ORM\Column(nullabletrue)]
  37.     private ?array $approved_by = [];
  38.     #[ORM\Column(nullabletrue)]
  39.     private ?array $declined_by = [];
  40.     public function __construct() {
  41.         $this->date_created = new \DateTime();
  42.     }
  43.     public function getId(): ?int
  44.     {
  45.         return $this->id;
  46.     }
  47.     public function getSuggestedEdit(): ?array
  48.     {
  49.         return $this->suggested_edit;
  50.     }
  51.     public function setSuggestedEdit(?array $suggested_edit): self
  52.     {
  53.         $this->suggested_edit $suggested_edit;
  54.         return $this;
  55.     }
  56.     public function getSuggestedEditField(): ?string
  57.     {
  58.         if (empty($this->suggested_edit)) {
  59.             return null;
  60.         }
  61.         return $this->suggested_edit['field'] ?? null;
  62.     }
  63.     public function getDateCreated(): ?\DateTimeInterface
  64.     {
  65.         return $this->date_created;
  66.     }
  67.     public function setDateCreated(?\DateTimeInterface $date_created): self
  68.     {
  69.         $this->date_created $date_created;
  70.         return $this;
  71.     }
  72.     public function getCrop(): ?Crop
  73.     {
  74.         return $this->crop;
  75.     }
  76.     public function setCrop(?Crop $crop): self
  77.     {
  78.         $this->crop $crop;
  79.         return $this;
  80.     }
  81.     public function getUser(): ?User
  82.     {
  83.         return $this->user;
  84.     }
  85.     public function setUser(?User $user): self
  86.     {
  87.         $this->user $user;
  88.         return $this;
  89.     }
  90.     public function getDateApplied(): ?\DateTimeInterface
  91.     {
  92.         return $this->date_applied;
  93.     }
  94.     public function setDateApplied(?\DateTimeInterface $date_applied): self
  95.     {
  96.         $this->date_applied $date_applied;
  97.         return $this;
  98.     }
  99.     public function getCreatedByAlphabeet(): ?bool
  100.     {
  101.         return $this->created_by_alphabeet;
  102.     }
  103.     public function setCreatedByAlphabeet(?bool $created_by_alphabeet): self
  104.     {
  105.         $this->created_by_alphabeet $created_by_alphabeet;
  106.         return $this;
  107.     }
  108.     public function getNeedsModerator(): ?int
  109.     {
  110.         return $this->needs_moderator;
  111.     }
  112.     public function setNeedsModerator(?int $needs_moderator): self
  113.     {
  114.         $this->needs_moderator $needs_moderator;
  115.         return $this;
  116.     }
  117.     public function getFeedback(): ?string
  118.     {
  119.         return $this->feedback;
  120.     }
  121.     public function setFeedback(?string $feedback): self
  122.     {
  123.         $this->feedback $feedback;
  124.         return $this;
  125.     }
  126.     public function getDateRead(): ?\DateTimeInterface
  127.     {
  128.         return $this->date_read;
  129.     }
  130.     public function setDateRead(?\DateTimeInterface $date_read): self
  131.     {
  132.         $this->date_read $date_read;
  133.         return $this;
  134.     }
  135.     public function getDeclined(): ?bool
  136.     {
  137.         return $this->declined;
  138.     }
  139.     public function setDeclined(?bool $declined): self
  140.     {
  141.         $this->declined $declined;
  142.         return $this;
  143.     }
  144.     public function getLocale(): ?string
  145.     {
  146.         return $this->locale;
  147.     }
  148.     public function setLocale(?string $locale): static
  149.     {
  150.         $this->locale $locale;
  151.         return $this;
  152.     }
  153.     public function getApprovedBy(): ?array
  154.     {
  155.         return $this->approved_by;
  156.     }
  157.     public function setApprovedBy(?array $approved_by): static
  158.     {
  159.         $this->approved_by $approved_by;
  160.         return $this;
  161.     }
  162.     public function addApprovedBy(int $userId): static
  163.     {
  164.         if (!$this->approved_by) {
  165.             $this->approved_by = [];
  166.         }
  167.         if (!in_array($userId$this->approved_by)) {
  168.             $this->approved_by[] = $userId;
  169.         }
  170.         return $this;
  171.     }
  172.     public function getApprovalCount(): int
  173.     {
  174.         if (empty($this->approved_by)) {
  175.             return 0;
  176.         }
  177.         return count($this->approved_by);
  178.     }
  179.     public function getDeclinedBy(): ?array
  180.     {
  181.         return $this->declined_by;
  182.     }
  183.     public function setDeclinedBy(?array $declined_by): static
  184.     {
  185.         $this->declined_by $declined_by;
  186.         return $this;
  187.     }
  188.     public function addDeclinedBy(int $userId): static
  189.     {
  190.         if (!$this->declined_by) {
  191.             $this->declined_by = [];
  192.         }
  193.         if (!in_array($userId$this->declined_by)) {
  194.             $this->declined_by[] = $userId;
  195.         }
  196.         return $this;
  197.     }
  198.     public function getDeclineCount(): int
  199.     {
  200.         if (empty($this->declined_by)) {
  201.             return 0;
  202.         }
  203.         return count($this->declined_by);
  204.     }
  205. }