src/Entity/GroupSuggestion.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\GroupSuggestionRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=GroupSuggestionRepository::class)
  9.  */
  10. class GroupSuggestion
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\Column(type="datetime")
  20.      */
  21.     private $cretedAt;
  22.     /**
  23.      * @ORM\ManyToOne(targetEntity=User::class, inversedBy="groupSuggestions")
  24.      * @ORM\JoinColumn(nullable=false)
  25.      */
  26.     private $user;
  27.     /**
  28.      * @ORM\OneToMany(targetEntity=Suggestion::class, mappedBy="groupsuggestion")
  29.      * @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
  30.      */
  31.     private $suggestions;
  32.     /**
  33.      * @ORM\ManyToOne(targetEntity=PropositionStatus::class, inversedBy="groupSuggestions")
  34.      * @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
  35.      */
  36.     private $status;
  37.     public function __construct()
  38.     {
  39.         $this->suggestions = new ArrayCollection();
  40.         $this->cretedAt = new \DateTime();
  41.     }
  42.     public function getId(): ?int
  43.     {
  44.         return $this->id;
  45.     }
  46.     public function getCretedAt(): ?\DateTimeInterface
  47.     {
  48.         return $this->cretedAt;
  49.     }
  50.     public function setCretedAt(\DateTimeInterface $cretedAt): self
  51.     {
  52.         $this->cretedAt $cretedAt;
  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.     /**
  65.      * @return Collection<int, Suggestion>
  66.      */
  67.     public function getSuggestions(): Collection
  68.     {
  69.         return $this->suggestions;
  70.     }
  71.     public function addSuggestion(Suggestion $suggestion): self
  72.     {
  73.         if (!$this->suggestions->contains($suggestion)) {
  74.             $this->suggestions[] = $suggestion;
  75.             $suggestion->setGroupsuggestion($this);
  76.         }
  77.         return $this;
  78.     }
  79.     public function removeSuggestion(Suggestion $suggestion): self
  80.     {
  81.         if ($this->suggestions->removeElement($suggestion)) {
  82.             // set the owning side to null (unless already changed)
  83.             if ($suggestion->getGroupsuggestion() === $this) {
  84.                 $suggestion->setGroupsuggestion(null);
  85.             }
  86.         }
  87.         return $this;
  88.     }
  89.     public function getStatus(): ?PropositionStatus
  90.     {
  91.         return $this->status;
  92.     }
  93.     public function setStatus(?PropositionStatus $status): self
  94.     {
  95.         $this->status $status;
  96.         return $this;
  97.     }
  98. }