src/Entity/PriceHistory.php line 19

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Product\ConfirmedProduct;
  4. use DateTime;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Exception;
  7. use Symfony\Component\Validator\Constraints as Assert;
  8. /**
  9.  * Class PriceHistory
  10.  *
  11.  * @ORM\Entity(repositoryClass="App\Repository\PriceHistoryRepository")
  12.  * @ORM\Table(name="malys_price_history")
  13.  * @ORM\HasLifecycleCallbacks()
  14.  * @package App\Entity
  15.  */
  16. class PriceHistory
  17. {
  18.     public const PRICE_COLS = [
  19.         'priceT1',
  20.         'priceT2',
  21.         'priceT3',
  22.         'priceT4',
  23.         'priceTO',
  24.         'priceTM',
  25.         'priceTG',
  26.         'priceTGR',
  27.         'pricePromo'
  28.     ];
  29.     /**
  30.      * @var integer
  31.      *
  32.      * @ORM\Column(name="id", type="integer")
  33.      * @ORM\Id
  34.      * @ORM\GeneratedValue(strategy="AUTO")
  35.      */
  36.     protected $id;
  37.     /**
  38.      * @var ConfirmedProduct
  39.      *
  40.      * @ORM\ManyToOne(targetEntity="App\Entity\Product\ConfirmedProduct", inversedBy="priceHistories")
  41.      * @ORM\JoinColumn(name="product_id", referencedColumnName="id")
  42.      * @Assert\Type("App\Entity\Product\ConfirmedProduct")
  43.      */
  44.     protected $product;
  45.     /**
  46.      * @var float
  47.      *
  48.      * @ORM\Column(name="price_tg", type="float", nullable=true)
  49.      */
  50.     protected $priceTG;
  51.     /**
  52.      * @var float
  53.      *
  54.      * @ORM\Column(name="price_tgr", type="float", nullable=true)
  55.      * @Assert\NotBlank
  56.      */
  57.     protected $priceTGR;
  58.     /**
  59.      * @var float
  60.      *
  61.      * @ORM\Column(name="price_t1", type="float", nullable=true)
  62.      */
  63.     protected $priceT1;
  64.     /**
  65.      * @var float
  66.      *
  67.      * @ORM\Column(name="price_t2", type="float", nullable=true)
  68.      */
  69.     protected $priceT2;
  70.     /**
  71.      * @var float
  72.      *
  73.      * @ORM\Column(name="price_t3", type="float", nullable=true)
  74.      */
  75.     protected $priceT3;
  76.     /**
  77.      * @var float
  78.      *
  79.      * @ORM\Column(name="price_t4", type="float", nullable=true)
  80.      */
  81.     protected $priceT4;
  82.     /**
  83.      * @var float
  84.      *
  85.      * @ORM\Column(name="price_tm", type="float", nullable=true)
  86.      */
  87.     protected $priceTM;
  88.     /**
  89.      * @var float
  90.      *
  91.      * @ORM\Column(name="price_promo", type="float", nullable=true)
  92.      */
  93.     protected $pricePromo;
  94.     /**
  95.      * @var array
  96.      *
  97.      * @ORM\Column(name="column_updated", type="array", nullable=true)
  98.      */
  99.     protected $columnUpdated;
  100.     /**
  101.      * @var DateTime
  102.      *
  103.      * @ORM\Column(name="updated_at", type="datetime", nullable=true)
  104.      */
  105.     protected $updatedAt;
  106.     /**
  107.      * PriceHistory constructor.
  108.      * @param ConfirmedProduct $product
  109.      */
  110.     public function __construct(ConfirmedProduct $product)
  111.     {
  112.         $this->setProduct($product);
  113.         $this->setPriceT1($product->getPriceT1());
  114.         $this->setPriceT2($product->getPriceT2());
  115.         $this->setPriceT3($product->getPriceT3());
  116.         $this->setPriceT4($product->getPriceT4());
  117.         $this->setPriceTM($product->getPriceTM());
  118.         $this->setPriceTG($product->getPriceTG());
  119.         $this->setPriceTGR($product->getPriceTGR());
  120.         $this->setPricePromo($product->getPricePromo());
  121.     }
  122.     public function __toString()
  123.     {
  124.         return $this->id;
  125.     }
  126.     /**
  127.      * @return int
  128.      */
  129.     public function getId()
  130.     {
  131.         return $this->id;
  132.     }
  133.     /**
  134.      * @param int $id
  135.      */
  136.     public function setId($id)
  137.     {
  138.         $this->id $id;
  139.     }
  140.     /**
  141.      * @return ConfirmedProduct
  142.      */
  143.     public function getProduct()
  144.     {
  145.         return $this->product;
  146.     }
  147.     /**
  148.      * @param ConfirmedProduct $product
  149.      */
  150.     public function setProduct($product)
  151.     {
  152.         $this->product $product;
  153.     }
  154.     /**
  155.      * @return float
  156.      */
  157.     public function getPriceTG()
  158.     {
  159.         return $this->priceTG;
  160.     }
  161.     /**
  162.      * @param float $priceTG
  163.      */
  164.     public function setPriceTG($priceTG)
  165.     {
  166.         $this->priceTG $priceTG;
  167.     }
  168.     /**
  169.      * @return float
  170.      */
  171.     public function getPriceTGR()
  172.     {
  173.         return $this->priceTGR;
  174.     }
  175.     /**
  176.      * @param float $priceTGR
  177.      */
  178.     public function setPriceTGR($priceTGR)
  179.     {
  180.         $this->priceTGR $priceTGR;
  181.     }
  182.     /**
  183.      * @return float
  184.      */
  185.     public function getPriceT1()
  186.     {
  187.         return $this->priceT1;
  188.     }
  189.     /**
  190.      * @param float $priceT1
  191.      */
  192.     public function setPriceT1($priceT1)
  193.     {
  194.         $this->priceT1 $priceT1;
  195.     }
  196.     /**
  197.      * @return float
  198.      */
  199.     public function getPriceT2()
  200.     {
  201.         return $this->priceT2;
  202.     }
  203.     /**
  204.      * @param float $priceT2
  205.      */
  206.     public function setPriceT2($priceT2)
  207.     {
  208.         $this->priceT2 $priceT2;
  209.     }
  210.     /**
  211.      * @return float
  212.      */
  213.     public function getPriceT3()
  214.     {
  215.         return $this->priceT3;
  216.     }
  217.     /**
  218.      * @param float $priceT3
  219.      */
  220.     public function setPriceT3($priceT3)
  221.     {
  222.         $this->priceT3 $priceT3;
  223.     }
  224.     /**
  225.      * @return float
  226.      */
  227.     public function getPriceT4()
  228.     {
  229.         return $this->priceT4;
  230.     }
  231.     /**
  232.      * @param float $priceT4
  233.      */
  234.     public function setPriceT4($priceT4)
  235.     {
  236.         $this->priceT4 $priceT4;
  237.     }
  238.     /**
  239.      * @return float
  240.      */
  241.     public function getPriceTM()
  242.     {
  243.         return $this->priceTM;
  244.     }
  245.     /**
  246.      * @param float $priceTM
  247.      */
  248.     public function setPriceTM($priceTM)
  249.     {
  250.         $this->priceTM $priceTM;
  251.     }
  252.     /**
  253.      * @return float
  254.      */
  255.     public function getPricePromo()
  256.     {
  257.         return $this->pricePromo;
  258.     }
  259.     /**
  260.      * @param float $pricePromo
  261.      */
  262.     public function setPricePromo($pricePromo)
  263.     {
  264.         $this->pricePromo $pricePromo;
  265.     }
  266.     /**
  267.      * @return array
  268.      */
  269.     public function getColumnUpdated()
  270.     {
  271.         return $this->columnUpdated;
  272.     }
  273.     /**
  274.      * @param array $columnUpdated
  275.      */
  276.     public function setColumnUpdated($columnUpdated)
  277.     {
  278.         $this->columnUpdated $columnUpdated;
  279.     }
  280.     /**
  281.      * @return DateTime
  282.      */
  283.     public function getUpdatedAt()
  284.     {
  285.         return $this->updatedAt;
  286.     }
  287.     /**
  288.      * Set updatedAt
  289.      *
  290.      * @return PriceHistory
  291.      * @ORM\PrePersist()
  292.      * @throws Exception
  293.      */
  294.     public function setUpdatedAt()
  295.     {
  296.         $this->updatedAt = new DateTime();
  297.         return $this;
  298.     }
  299. }