src/Entity/Rate.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\RateRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\Serializer\Annotation\Groups;
  8. #[ORM\Entity(repositoryClassRateRepository::class)]
  9. class Rate
  10. {
  11.     #[ORM\Id]
  12.     #[ORM\GeneratedValue]
  13.     #[ORM\Column]
  14.     private ?int $id null;
  15.     #[ORM\ManyToMany(targetEntityRecipe::class, inversedBy'rates')]
  16.     private Collection $recipe;
  17.     #[ORM\ManyToMany(targetEntityUser::class, inversedBy'rates')]
  18.     #[Groups(["show_recipe"])]
  19.     private Collection $user;
  20.     #[ORM\Column(length255)]
  21.     #[Groups(["show_recipe"])]
  22.     private ?string $number_of_start null;
  23.     public function __construct()
  24.     {
  25.         $this->recipe = new ArrayCollection();
  26.         $this->user = new ArrayCollection();
  27.     }
  28.     public function getId(): ?int
  29.     {
  30.         return $this->id;
  31.     }
  32.     /**
  33.      * @return Collection<int, Recipe>
  34.      */
  35.     /* 
  36.         public function getRecipe(): Collection
  37.         {
  38.             return $this->recipe;
  39.         }
  40.        
  41.         public function removeRecipe(Recipe $recipe): self
  42.         {
  43.             $this->recipe->removeElement($recipe);
  44.             return $this;
  45.         }
  46.     */
  47.     public function addRecipe(Recipe $recipe): self
  48.     {
  49.         if (!$this->recipe->contains($recipe)) {
  50.             $this->recipe->add($recipe);
  51.         }
  52.         return $this;
  53.     }
  54.     /**
  55.      * @return Collection<int, User>
  56.      */
  57.     public function getUser(): Collection
  58.     {
  59.         return $this->user;
  60.     }
  61.     public function addUser(User $user): self
  62.     {
  63.         if (!$this->user->contains($user)) {
  64.             $this->user->add($user);
  65.         }
  66.         return $this;
  67.     }
  68.     public function removeUser(User $user): self
  69.     {
  70.         $this->user->removeElement($user);
  71.         return $this;
  72.     }
  73.     public function getNumberOfStart(): ?string
  74.     {
  75.         return $this->number_of_start;
  76.     }
  77.     public function setNumberOfStart(string $number_of_start): self
  78.     {
  79.         $this->number_of_start $number_of_start;
  80.         return $this;
  81.     }
  82. }