<?phpnamespace App\Entity;use App\Repository\MagasinRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;#[ORM\Entity(repositoryClass: MagasinRepository::class)]class Magasin{ #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column] private ?int $id = null; #[ORM\Column(length: 150)] private ?string $nom = null; #[ORM\Column(length: 255, nullable: true)] private ?string $logo_path = null; #[ORM\Column(nullable: true)] private ?bool $active = null; #[ORM\OneToMany(mappedBy: 'magasin', targetEntity: MagasinUser::class)] private Collection $magasinsUser; #[ORM\OneToMany(mappedBy: 'magasin', targetEntity: Produit::class)] private Collection $produits; public function __construct() { $this->user_id = new ArrayCollection(); $this->users = new ArrayCollection(); $this->magasinsUser = new ArrayCollection(); $this->produits = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getNom(): ?string { return $this->nom; } public function setNom(string $nom): static { $this->nom = $nom; return $this; } public function getLogoPath(): ?string { return $this->logo_path; } public function setLogoPath(?string $logo_path): static { $this->logo_path = $logo_path; return $this; } public function isActive(): ?bool { return $this->active; } public function setActive(?bool $active): static { $this->active = $active; return $this; } public function __toString(): string{ return $this->nom; // ou toute autre propriété lisible (ville, code, etc.)} /** * @return Collection<int, MagasinUser> */ public function getMagasinsUser(): Collection { return $this->magasinsUser; } public function addMagasinsUser(MagasinUser $magasinsUser): static { if (!$this->magasinsUser->contains($magasinsUser)) { $this->magasinsUser->add($magasinsUser); $magasinsUser->setMagasin($this); } return $this; } public function removeMagasinsUser(MagasinUser $magasinsUser): static { if ($this->magasinsUser->removeElement($magasinsUser)) { // set the owning side to null (unless already changed) if ($magasinsUser->getMagasin() === $this) { $magasinsUser->setMagasin(null); } } return $this; } /** * @return Collection<int, Produit> */ public function getProduits(): Collection { return $this->produits; } public function addProduit(Produit $produit): static { if (!$this->produits->contains($produit)) { $this->produits->add($produit); $produit->setMagasin($this); } return $this; } public function removeProduit(Produit $produit): static { if ($this->produits->removeElement($produit)) { // set the owning side to null (unless already changed) if ($produit->getMagasin() === $this) { $produit->setMagasin(null); } } return $this; }}