src/Entity/System/ProductTracking.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity\System;
  3. use Doctrine\ORM\Mapping as ORM;
  4. /**
  5.  * @ORM\Table(name="ps_product_tracking")
  6.  *
  7.  * @ORM\Entity(repositoryClass="App\Repository\System\ProductTrackingRepository")
  8.  */
  9. class ProductTracking
  10. {
  11.     /**
  12.      * @var int
  13.      *
  14.      * @ORM\Id
  15.      *
  16.      * @ORM\GeneratedValue(strategy="AUTO")
  17.      *
  18.      * @ORM\Column(type="integer", name="id_product_tracking")
  19.      */
  20.     private $id;
  21.     /**
  22.      * @var Product
  23.      *
  24.      * @ORM\ManyToOne(targetEntity="Product")
  25.      *
  26.      * @ORM\JoinColumn(name="id_product", referencedColumnName="id_product", nullable=false)
  27.      */
  28.     private $product;
  29.     /**
  30.      * @var ProductAttribute|null
  31.      *
  32.      * @ORM\ManyToOne(targetEntity="App\Entity\System\ProductAttribute")
  33.      *
  34.      * @ORM\JoinColumn(name="id_product_attribute", referencedColumnName="id_product_attribute", nullable=true)
  35.      */
  36.     private $productAttribute;
  37.     /**
  38.      * @var \DateTime
  39.      *
  40.      * @ORM\Column(type="datetime")
  41.      */
  42.     private $dateAdd;
  43.     /**
  44.      * @var \DateTime
  45.      *
  46.      * @ORM\Column(type="datetime")
  47.      */
  48.     private $dateUpd;
  49.     /**
  50.      * @var bool
  51.      *
  52.      * @ORM\Column(type="boolean", options={"default" : 0})
  53.      */
  54.     private $sendMail;
  55.     /**
  56.      * @var Wishlist
  57.      *
  58.      * @ORM\ManyToOne(targetEntity="Wishlist")
  59.      *
  60.      * @ORM\JoinColumn(name="wishlist_id", referencedColumnName="id", nullable=false)
  61.      */
  62.     private $wishlist;
  63.     public static function createFromProduct(Product $productWishlist $wishlist, \DateTime $dateAdd$sendEmail false): self
  64.     {
  65.         $pt = new self();
  66.         $pt->product $product;
  67.         $pt->wishlist $wishlist;
  68.         $pt->dateAdd $dateAdd;
  69.         $pt->dateUpd $dateAdd;
  70.         $pt->sendMail $sendEmail;
  71.         return $pt;
  72.     }
  73.     public static function createFromProductAttribute(ProductAttribute $productAttributeWishlist $wishlist, \DateTime $dateAdd$sendEmail false): self
  74.     {
  75.         $pt = new self();
  76.         $pt->product $productAttribute->getProduct();
  77.         $pt->productAttribute $productAttribute;
  78.         $pt->wishlist $wishlist;
  79.         $pt->dateAdd $dateAdd;
  80.         $pt->dateUpd $dateAdd;
  81.         $pt->sendMail $sendEmail;
  82.         return $pt;
  83.     }
  84.     /**
  85.      * @param Product $product
  86.      */
  87.     public function setProduct(Product $product): void
  88.     {
  89.         $this->product $product;
  90.     }
  91.     /**
  92.      * @param ProductAttribute|null $productAttribute
  93.      */
  94.     public function setProductAttribute(?ProductAttribute $productAttribute): void
  95.     {
  96.         $this->productAttribute $productAttribute;
  97.     }
  98.     /**
  99.      * @param \DateTime $dateAdd
  100.      */
  101.     public function setDateAdd(\DateTime $dateAdd): void
  102.     {
  103.         $this->dateAdd $dateAdd;
  104.     }
  105.     /**
  106.      * @param \DateTime $dateUpd
  107.      */
  108.     public function setDateUpd(\DateTime $dateUpd): void
  109.     {
  110.         $this->dateUpd $dateUpd;
  111.     }
  112.     /**
  113.      * @param bool $sendMail
  114.      */
  115.     public function setSendMail(bool $sendMail): void
  116.     {
  117.         $this->sendMail $sendMail;
  118.     }
  119.     /**
  120.      * @return int
  121.      */
  122.     public function getId(): int
  123.     {
  124.         return $this->id;
  125.     }
  126.     /**
  127.      * @return Product
  128.      */
  129.     public function getProduct(): Product
  130.     {
  131.         return $this->product;
  132.     }
  133.     /**
  134.      * @return ProductAttribute|null
  135.      */
  136.     public function getProductAttribute(): ?ProductAttribute
  137.     {
  138.         return $this->productAttribute;
  139.     }
  140.     /**
  141.      * @param Wishlist $wishlist
  142.      */
  143.     public function setWishlist(Wishlist $wishlist): void
  144.     {
  145.         $this->wishlist $wishlist;
  146.     }
  147. }