<?phpnamespace App\Entity;use App\Repository\ProductUniqueRepository;use App\Entity\Brand;use App\Repository\UnitMeasurementRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;use Gedmo\Blameable\Traits\BlameableEntity;use Gedmo\Timestampable\Traits\TimestampableEntity;use Symfony\Component\Serializer\Annotation\Groups;use Symfony\Component\Validator\Constraints as Assert;#[ORM\Entity(repositoryClass: ProductUniqueRepository::class)]class ProductUnique{ use BlameableEntity; //Hook blameable behaviour. Updates createdBy, updatedBy fields use TimestampableEntity; //Hook timestampable behaviour. Updates createdAt, updatedAt fields #[ORM\Id] #[ORM\GeneratedValue(strategy: "IDENTITY")] #[ORM\Column] #[Groups("serial")] private ?int $id = null; #[ORM\Column(length: 127)] #[Assert\NotNull()] #[Assert\Length(max: 127)] #[Groups("serial")] private ?string $name = null; #[ORM\OneToMany(mappedBy: 'productUnique', targetEntity: Product::class)] private Collection $products; #[ORM\ManyToOne(inversedBy: 'productUniques')] #[ORM\JoinColumn(nullable: false)] private ?Producer $Producer = null; #[ORM\Column(length: 50)] #[Groups("serial")] private ?string $ean = null; #[ORM\ManyToOne] #[ORM\JoinColumn(nullable: false)] #[Groups("serial")] private ?Iva $iva = null; #[ORM\Column] #[Groups("serial")] private ?bool $onlyAdults = false; #[ORM\Column(nullable: true)] #[Groups("serial")] private ?int $unitsPerBox = null; #[ORM\ManyToOne(inversedBy: 'productUniques')] #[Groups("serial")] #[ORM\JoinColumn(nullable: false)] private ?UnitMeasurement $unitMeasurement; #[ORM\Column(nullable: true)] #[Groups("serial")] private ?float $weight = null; #[ORM\Column(nullable: true)] #[Groups("serial")] private ?int $width = null; #[ORM\Column(nullable: true)] #[Groups("serial")] private ?int $length = null; #[ORM\Column(nullable: true)] #[Groups("serial")] private ?int $height = null; #[ORM\Column(nullable: true)] #[Groups("serial")] private ?float $volumetricWeight = null; #[ORM\Column(length: 20)] #[Groups("serial")] private ?string $logisticalID = null; #[ORM\ManyToOne(inversedBy: 'productUniques', targetEntity: Brand::class)] #[ORM\JoinColumn(nullable: false)] #[Groups("serial")] private ?Brand $brand = null; #[ORM\ManyToOne(inversedBy: 'productUniques')] #[Groups("serial")] private ?Shipping $shipping = null; 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; } /** * @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->setProductUnique($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->getProductUnique() === $this) { $product->setProductUnique(null); } } return $this; } public function getProducer(): ?Producer { return $this->Producer; } public function setProducer(?Producer $Producer): self { $this->Producer = $Producer; return $this; } public function getEan(): ?string { return $this->ean; } public function setEan(string $ean): self { $this->ean = $ean; return $this; } public function getIva(): ?iva { return $this->iva; } public function setIva(?iva $iva): self { $this->iva = $iva; return $this; } public function isOnlyAdults(): ?bool { return $this->onlyAdults; } public function setOnlyAdults(bool $onlyAdults): self { $this->onlyAdults = $onlyAdults; return $this; } public function getUnitsPerBox(): ?int { return $this->unitsPerBox; } public function setUnitsPerBox(?int $unitsPerBox): self { $this->unitsPerBox = $unitsPerBox; return $this; } public function getWeight(): ?float { return $this->weight; } public function setWeight(?float $weight): self { $this->weight = $weight; return $this; } public function getWidth(): ?int { return $this->width; } public function setWidth(?int $width): self { $this->width = $width; return $this; } public function getLength(): ?int { return $this->length; } public function setLength(?int $length): self { $this->length = $length; return $this; } public function getHeight(): ?int { return $this->height; } public function setHeight(?int $height): self { $this->height = $height; return $this; } public function getVolumetricWeight(): ?float { return $this->volumetricWeight; } public function setVolumetricWeight(?float $volumetricWeight): self { $this->volumetricWeight = $volumetricWeight; return $this; } public function getLogisticalID(): ?string { return $this->logisticalID; } public function setLogisticalID(string $logisticalID): self { $this->logisticalID = $logisticalID; return $this; } public function getBrand(): ?Brand { return $this->brand; } public function setBrand(?Brand $brand): self { $this->brand = $brand; return $this; } public function getUnitMeasurement(): ?UnitMeasurement { return $this->unitMeasurement; } public function setUnitMeasurement(?UnitMeasurement $unitMeasurement): self { $this->unitMeasurement = $unitMeasurement; return $this; } public function getShipping(): ?Shipping { return $this->shipping; } public function setShipping(?Shipping $shipping): self { $this->shipping = $shipping; return $this; }}