src/Entity/Utensil.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\UtensilRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassUtensilRepository::class)]
  8. class Utensil
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column]
  13.     private ?int $id null;
  14.     #[ORM\Column(length255)]
  15.     private ?string $nom null;
  16.     #[ORM\Column(length255nullabletrue)]
  17.     private ?string $description null;
  18.     #[ORM\Column(length255nullabletrue)]
  19.     private ?string $image null;
  20.     #[ORM\Column(length255nullabletrue)]
  21.     private ?string $prix null;
  22.     #[ORM\ManyToOne(inversedBy'utensils')]
  23.     private ?ProductType $productType null;
  24.     #[ORM\ManyToMany(targetEntityRecipe::class, inversedBy'utensils')]
  25.     private Collection $recipe;
  26.     public function __construct()
  27.     {
  28.         $this->recipe = new ArrayCollection();
  29.     }
  30.     public function getId(): ?int
  31.     {
  32.         return $this->id;
  33.     }
  34.     public function getNom(): ?string
  35.     {
  36.         return $this->nom;
  37.     }
  38.     public function setNom(string $nom): self
  39.     {
  40.         $this->nom $nom;
  41.         return $this;
  42.     }
  43.     public function getDescription(): ?string
  44.     {
  45.         return $this->description;
  46.     }
  47.     public function setDescription(?string $description): self
  48.     {
  49.         $this->description $description;
  50.         return $this;
  51.     }
  52.     public function getImage(): ?string
  53.     {
  54.         return $this->image;
  55.     }
  56.     public function setImage(?string $image): self
  57.     {
  58.         $this->image $image;
  59.         return $this;
  60.     }
  61.     public function getPrix(): ?string
  62.     {
  63.         return $this->prix;
  64.     }
  65.     public function setPrix(?string $prix): self
  66.     {
  67.         $this->prix $prix;
  68.         return $this;
  69.     }
  70.     public function getProductType(): ?productType
  71.     {
  72.         return $this->productType;
  73.     }
  74.     public function setProductType(?productType $productType): self
  75.     {
  76.         $this->productType $productType;
  77.         return $this;
  78.     }
  79.     /**
  80.      * @return Collection<int, Recipe>
  81.      */
  82.     // public function getRecipe(): Collection
  83.     // {
  84.     //     return $this->recipe;
  85.     // }
  86.     public function addRecipe(Recipe $recipe): self
  87.     {
  88.         if (!$this->recipe->contains($recipe)) {
  89.             $this->recipe->add($recipe);
  90.         }
  91.         return $this;
  92.     }
  93.     public function removeRecipe(Recipe $recipe): self
  94.     {
  95.         $this->recipe->removeElement($recipe);
  96.         return $this;
  97.     }
  98. }