src/Entity/Gos/ProductVariantUpselling.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Gos;
  3. use App\Repository\Gos\ProductVariantUpsellingRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Symfony\Component\HttpFoundation\File\File;
  6. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  7. /**
  8.  * @ORM\Entity(repositoryClass=ProductVariantUpsellingRepository::class)
  9.  * @ORM\HasLifecycleCallbacks
  10.  * @Vich\Uploadable
  11.  */
  12. class ProductVariantUpselling
  13. {
  14.     /**
  15.      * @ORM\Id
  16.      * @ORM\GeneratedValue
  17.      * @ORM\Column(type="integer")
  18.      */
  19.     private $id;
  20.     /**
  21.      * @ORM\Column(type="string", length=255, nullable=true)
  22.      */
  23.     private $imageUrl;
  24.     /**
  25.      * @ORM\Column(type="boolean", nullable=true)
  26.      */
  27.     private $useUploadedImage;
  28.     /**
  29.      * @ORM\Column(type="string", length=255, nullable=true)
  30.      * @var string
  31.      */
  32.     private $uploadedImage;
  33.     /**
  34.      * @Vich\UploadableField(mapping="upselling_image", fileNameProperty="uploadedImage")
  35.      */
  36.     private $imageFile;
  37.     /**
  38.      * @ORM\Column(type="text", nullable=true)
  39.      */
  40.     private $description;
  41.     /**
  42.      * @ORM\ManyToOne(targetEntity=ProductVariant::class, inversedBy="productVariantPromoted")
  43.      * @ORM\JoinColumn(nullable=false)
  44.      */
  45.     private $promotedProduct;
  46.     /**
  47.      * @ORM\ManyToOne(targetEntity=ProductVariant::class, inversedBy="productVariantUpsellings")
  48.      * @ORM\JoinColumn(nullable=false)
  49.      */
  50.     private $productVariant;
  51.     /**
  52.      * @ORM\Column(type="datetime")
  53.      */
  54.     private $createdAt;
  55.     /**
  56.      * @ORM\Column(type="datetime", nullable=true)
  57.      */
  58.     private $updatedAt;
  59.     /**
  60.      * @ORM\PrePersist()
  61.      */
  62.     public function prePersist()
  63.     {
  64.         $this->createdAt = new \DateTime();
  65.     }
  66.     /**
  67.      * @ORM\PreUpdate()
  68.      */
  69.     public function preUpdate()
  70.     {
  71.         $this->updatedAt = new \DateTime();
  72.     }
  73.     public function getId(): ?int
  74.     {
  75.         return $this->id;
  76.     }
  77.     public function getImageUrl(): ?string
  78.     {
  79.         return $this->imageUrl;
  80.     }
  81.     public function setImageUrl(?string $imageUrl): self
  82.     {
  83.         $this->imageUrl $imageUrl;
  84.         return $this;
  85.     }
  86.     public function getUseUploadedImage(): ?bool
  87.     {
  88.         return $this->useUploadedImage;
  89.     }
  90.     public function setUseUploadedImage(bool $useUploadedImage): self
  91.     {
  92.         $this->useUploadedImage $useUploadedImage;
  93.         return $this;
  94.     }
  95.     public function setImageFile(?File $imageFile null)
  96.     {
  97.         $this->imageFile $imageFile;
  98.         if ($imageFile)
  99.         {
  100.             $this->updatedAt = new \DateTime('now');
  101.         }
  102.     }
  103.     public function getImageFile(): ?File
  104.     {
  105.         return $this->imageFile;
  106.     }
  107.     public function setUploadedImage(?string $uploadedImage)
  108.     {
  109.         $this->uploadedImage $uploadedImage;
  110.     }
  111.     public function getUploadedImage()
  112.     {
  113.         return $this->uploadedImage;
  114.     }
  115.     public function getDescription(): ?string
  116.     {
  117.         return $this->description;
  118.     }
  119.     public function setDescription(?string $description): self
  120.     {
  121.         $this->description $description;
  122.         return $this;
  123.     }
  124.     public function getPromotedProduct(): ?ProductVariant
  125.     {
  126.         return $this->promotedProduct;
  127.     }
  128.     public function setPromotedProduct(?ProductVariant $promotedProduct): self
  129.     {
  130.         $this->promotedProduct $promotedProduct;
  131.         return $this;
  132.     }
  133.     public function getProductVariant(): ?ProductVariant
  134.     {
  135.         return $this->productVariant;
  136.     }
  137.     public function setProductVariant(?ProductVariant $productVariant): self
  138.     {
  139.         $this->productVariant $productVariant;
  140.         return $this;
  141.     }
  142.     public function getCreatedAt(): ?\DateTimeInterface
  143.     {
  144.         return $this->createdAt;
  145.     }
  146.     public function setCreatedAt(\DateTimeInterface $createdAt): self
  147.     {
  148.         $this->createdAt $createdAt;
  149.         return $this;
  150.     }
  151.     public function getUpdatedAt(): ?\DateTimeInterface
  152.     {
  153.         return $this->updatedAt;
  154.     }
  155.     public function setUpdatedAt(?\DateTimeInterface $updatedAt): self
  156.     {
  157.         $this->updatedAt $updatedAt;
  158.         return $this;
  159.     }
  160. }