<?phpnamespace App\Entity\BC;use App\Repository\BC\VatProductGroupRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;#[ORM\Entity(repositoryClass: VatProductGroupRepository::class)]#[ORM\HasLifecycleCallbacks]class VatProductGroup{ #[ORM\Id] #[ORM\Column(type: 'string', length: 50)] private string $id; #[ORM\Column(type: 'string', length: 255, nullable: true)] private ?string $productDesc = null; #[ORM\OneToMany(mappedBy: 'vatProductGroup', targetEntity: VatCombination::class, cascade: ['persist', 'remove'], orphanRemoval: true )] private Collection $combinations; #[ORM\Column(type: 'datetime_immutable')] private \DateTimeImmutable $createdAt; #[ORM\Column(type: 'datetime_immutable', nullable: true)] private ?\DateTimeImmutable $updatedAt = null; public function __construct(string $productCode) { $this->id = $productCode; $this->combinations = new ArrayCollection(); } #[ORM\PrePersist] public function onPrePersist(): void { $this->createdAt = new \DateTimeImmutable(); } #[ORM\PreUpdate] public function onPreUpdate(): void { $this->updatedAt = new \DateTimeImmutable(); } public function getId(): string { return $this->id; } public function getProductDesc(): ?string { return $this->productDesc; } public function setProductDesc(?string $productDesc): void { $this->productDesc = $productDesc; } public function getCombinations(): Collection { return $this->combinations; } public function addCombination(VatCombination $combination): void { if (!$this->combinations->contains($combination)) { $this->combinations->add($combination); $combination->setVatProductGroup($this); } } public function removeCombination(VatCombination $combination): void { if ($this->combinations->removeElement($combination)) { if ($combination->getVatProductGroup() === $this) { $combination->setVatProductGroup(null); } } } public function clearCombinations(): void { foreach ($this->combinations as $combination) { $this->removeCombination($combination); } } public function getCreatedAt(): \DateTimeImmutable { return $this->createdAt; } public function getUpdatedAt(): ?\DateTimeImmutable { return $this->updatedAt; }}