<?phpnamespace App\Entity;use App\Repository\ManufacturerRepository;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=ManufacturerRepository::class) */class Manufacturer{ /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") * @Groups({"Manufacturer_read"}) */ private $id; /** * @Groups({"Manufacturer_read"}) * @ORM\Column(type="string", length=255) */ private $name; /** * @ORM\Column(type="datetime_immutable") */ private $updatedAt; /** * @ORM\OneToMany(targetEntity=Product::class, mappedBy="manufacturer") */ private $products; public function __construct() { $this->products = 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; } public function getUpdatedAt(): ?\DateTimeImmutable { return $this->updatedAt; } public function setUpdatedAt(\DateTimeImmutable $updatedAt): self { $this->updatedAt = $updatedAt; 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[] = $product; $product->setManufacturer($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->getManufacturer() === $this) { $product->setManufacturer(null); } } return $this; }}