src/Entity/Tissu.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\TissuRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassTissuRepository::class)]
  8. class Tissu
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column]
  13.     private ?int $id null;
  14.     #[ORM\Column(length255nullabletrue)]
  15.     private ?string $titer null;
  16.     #[ORM\ManyToOne(inversedBy'tissus')]
  17.     private ?Produits $produit null;
  18.     #[ORM\OneToMany(targetEntityArticle::class, mappedBy'tissu'cascade: ["remove""persist"])]
  19.     private Collection $articles;
  20.     public function __construct()
  21.     {
  22.         $this->articles = new ArrayCollection();
  23.     }
  24.     public function getId(): ?int
  25.     {
  26.         return $this->id;
  27.     }
  28.     public function getTiter(): ?string
  29.     {
  30.         return $this->titer;
  31.     }
  32.     public function setTiter(?string $titer): static
  33.     {
  34.         $this->titer $titer;
  35.         return $this;
  36.     }
  37.     /**
  38.      * @return Collection<int, Article>
  39.      */
  40.     public function getArticles(): Collection
  41.     {
  42.         return $this->articles;
  43.     }
  44.     public function addArticle(Article $article): static
  45.     {
  46.         if (!$this->articles->contains($article)) {
  47.             $this->articles->add($article);
  48.             $article->setTissu($this);
  49.         }
  50.         return $this;
  51.     }
  52.     public function removeArticle(Article $article): static
  53.     {
  54.         if ($this->articles->removeElement($article)) {
  55.             // set the owning side to null (unless already changed)
  56.             if ($article->getTissu() === $this) {
  57.                 $article->setTissu(null);
  58.             }
  59.         }
  60.         return $this;
  61.     }
  62. }