src/Entity/ProductDetail.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ProductDetailRepository;
  4. use Doctrine\DBAL\Types\Types;
  5. use Doctrine\ORM\Mapping as ORM;
  6. #[ORM\Entity(repositoryClassProductDetailRepository::class)]
  7. #[ORM\Table(name'product_details')]
  8. class ProductDetail
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column]
  13.     private ?int $id null;
  14.     #[ORM\ManyToOne(inversedBy'details')]
  15.     #[ORM\JoinColumn(nullablefalseonDelete'CASCADE')]
  16.     private ?Product $product null;
  17.     #[ORM\Column(length255)]
  18.     private ?string $label null// Ex: "Matériau", "Garantie", "Dimensions", etc.
  19.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  20.     private ?string $value null// La valeur du détail
  21.     #[ORM\Column]
  22.     private ?int $sortOrder 0;
  23.     #[ORM\Column]
  24.     private ?bool $isActive true;
  25.     #[ORM\Column]
  26.     private ?\DateTimeImmutable $createdAt null;
  27.     #[ORM\Column]
  28.     private ?\DateTimeImmutable $updatedAt null;
  29.     public function __construct()
  30.     {
  31.         $this->createdAt = new \DateTimeImmutable();
  32.         $this->updatedAt = new \DateTimeImmutable();
  33.     }
  34.     public function getId(): ?int
  35.     {
  36.         return $this->id;
  37.     }
  38.     public function getProduct(): ?Product
  39.     {
  40.         return $this->product;
  41.     }
  42.     public function setProduct(?Product $product): static
  43.     {
  44.         $this->product $product;
  45.         return $this;
  46.     }
  47.     public function getLabel(): ?string
  48.     {
  49.         return $this->label;
  50.     }
  51.     public function setLabel(string $label): static
  52.     {
  53.         $this->label $label;
  54.         return $this;
  55.     }
  56.     public function getValue(): ?string
  57.     {
  58.         return $this->value;
  59.     }
  60.     public function setValue(?string $value): static
  61.     {
  62.         $this->value $value;
  63.         return $this;
  64.     }
  65.     public function getSortOrder(): ?int
  66.     {
  67.         return $this->sortOrder;
  68.     }
  69.     public function setSortOrder(int $sortOrder): static
  70.     {
  71.         $this->sortOrder $sortOrder;
  72.         return $this;
  73.     }
  74.     public function isIsActive(): ?bool
  75.     {
  76.         return $this->isActive;
  77.     }
  78.     public function setIsActive(bool $isActive): static
  79.     {
  80.         $this->isActive $isActive;
  81.         return $this;
  82.     }
  83.     public function getCreatedAt(): ?\DateTimeImmutable
  84.     {
  85.         return $this->createdAt;
  86.     }
  87.     public function setCreatedAt(\DateTimeImmutable $createdAt): static
  88.     {
  89.         $this->createdAt $createdAt;
  90.         return $this;
  91.     }
  92.     public function getUpdatedAt(): ?\DateTimeImmutable
  93.     {
  94.         return $this->updatedAt;
  95.     }
  96.     public function setUpdatedAt(\DateTimeImmutable $updatedAt): static
  97.     {
  98.         $this->updatedAt $updatedAt;
  99.         return $this;
  100.     }
  101. }