<?phpnamespace App\Entity;use App\Model\Entity;use App\Repository\ProviderRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;#[ORM\Entity(repositoryClass: ProviderRepository::class)]class Provider extends Entity{ #[ORM\Column(length: 255)] private ?string $name = null; #[ORM\ManyToMany(targetEntity: Family::class, inversedBy: 'providers')] private Collection $families; #[ORM\OneToMany(mappedBy: 'provider', targetEntity: Product::class)] private Collection $products; public function __construct(string $name = null) { $this->name = $name; $this->families = new ArrayCollection(); $this->products = new ArrayCollection(); } public function getName(): ?string { return $this->name; } public function setName(string $name): self { $this->name = $name; return $this; } /** * @return Collection<int, Family> */ public function getFamilies(): Collection { return $this->families; } public function addFamily(Family $family): self { if (!$this->families->contains($family)) { $this->families->add($family); } return $this; } public function removeFamily(Family $family): self { $this->families->removeElement($family); return $this; } /** * @return Collection<int, Product> */ public function getProducts(): Collection { return $this->products; } public function addProduct(Product $product): self { if (!$this->products->contains($product)) { $this->products->add($product); $product->setProvider($this); } return $this; } public function removeProduct(Product $product): self { if ($this->products->removeElement($product)) { // set the owning side to null (unless already changed) if ($product->getProvider() === $this) { $product->setProvider(null); } } return $this; } public function __toString(): string { return $this->name; }}