src/Entity/Image.php line 6

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ImageRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. #[ORM\Entity(repositoryClassImageRepository::class)]
  6. class Image
  7. {
  8.     #[ORM\Id]
  9.     #[ORM\GeneratedValue]
  10.     #[ORM\Column]
  11.     private ?int $id null;
  12.     #[ORM\Column(length255)]
  13.     private ?string $fileName null;
  14.     #[ORM\Column(length255)]
  15.     private ?string $imageUrl null;
  16.     #[ORM\ManyToOne(inversedBy'images')]
  17.     #[ORM\JoinColumn(nullablefalse)]
  18.     private ?Produit $produit null;
  19.     // ── NEW: optional link to a specific variant ──
  20.     #[ORM\ManyToOne(inversedBy'images')]
  21.     #[ORM\JoinColumn(nullabletrueonDelete'SET NULL')]
  22.     private ?ProduitVariant $produitVariant null;
  23.     public function getId(): ?int
  24.     {
  25.         return $this->id;
  26.     }
  27.     public function getFileName(): ?string
  28.     {
  29.         return $this->fileName;
  30.     }
  31.     public function setFileName(string $fileName): self
  32.     {
  33.         $this->fileName $fileName;
  34.         return $this;
  35.     }
  36.     public function getImageUrl(): ?string
  37.     {
  38.         return $this->imageUrl;
  39.     }
  40.     public function setImageUrl(string $imageUrl): self
  41.     {
  42.         $this->imageUrl $imageUrl;
  43.         return $this;
  44.     }
  45.     public function getProduit(): ?Produit
  46.     {
  47.         return $this->produit;
  48.     }
  49.     public function setProduit(?Produit $produit): self
  50.     {
  51.         $this->produit $produit;
  52.         return $this;
  53.     }
  54.     public function getProduitVariant(): ?ProduitVariant
  55.     {
  56.         return $this->produitVariant;
  57.     }
  58.     public function setProduitVariant(?ProduitVariant $produitVariant): self
  59.     {
  60.         $this->produitVariant $produitVariant;
  61.         return $this;
  62.     }
  63. }