<?phpnamespace App\Entity;use App\Repository\BrandRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;use Symfony\Component\Serializer\Annotation\Groups;/** * @ORM\Entity(repositoryClass=BrandRepository::class) */class Brand{ /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") * @Groups({"stock_edit", "installation_edit"}) */ private $id; /** * @ORM\Column(type="string", length=255) * @Groups({"stock_edit"}) */ private $name; /** * @ORM\OneToMany(targetEntity=Stock::class, mappedBy="brand") */ private $stocks; /** * @ORM\OneToMany(targetEntity=Reference::class, mappedBy="brand") */ private $brand_references; /** * @ORM\ManyToOne(targetEntity=Supplier::class, inversedBy="brands") * @Groups({"stock_edit"}) */ private $supplier; public function __construct() { $this->stocks = new ArrayCollection(); $this->brand_references = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getName(): ?string { return $this->name; } public function setName(string $name): self { $this->name = $name; return $this; } /** * @return Collection<int, Stock> */ public function getStocks(): Collection { return $this->stocks; } public function addStock(Stock $stock): self { if (!$this->stocks->contains($stock)) { $this->stocks[] = $stock; $stock->setBrand($this); } return $this; } public function removeStock(Stock $stock): self { if ($this->stocks->removeElement($stock)) { // set the owning side to null (unless already changed) if ($stock->getBrand() === $this) { $stock->setBrand(null); } } return $this; } /** * @return Collection<int, Reference> */ public function getBrandReferences(): Collection { return $this->brand_references; } public function addBrandReference(Reference $brandReference): self { if (!$this->brand_references->contains($brandReference)) { $this->brand_references[] = $brandReference; $brandReference->setBrand($this); } return $this; } public function removeBrandReference(Reference $brandReference): self { if ($this->brand_references->removeElement($brandReference)) { // set the owning side to null (unless already changed) if ($brandReference->getBrand() === $this) { $brandReference->setBrand(null); } } return $this; } public function getSupplier(): ?Supplier { return $this->supplier; } public function setSupplier(?Supplier $supplier): self { $this->supplier = $supplier; return $this; }}