src/Entity/PriceOptimized.php line 18

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Validator\Constraints as AppAssert;
  4. use App\Entity\Product\ConfirmedProduct;
  5. use DateTime;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\Validator\Constraints as Assert;
  8. /**
  9.  * @ORM\Entity(repositoryClass="App\Repository\PriceOptimizedRepository")
  10.  * @ORM\Table(name="malys_price_optimized")
  11.  * @ORM\HasLifecycleCallbacks()
  12.  * @package App\Entity
  13.  * @AppAssert\OptimizedPriceDates
  14.  */
  15. class PriceOptimized
  16. {
  17.     /**
  18.      * @var integer
  19.      *
  20.      * @ORM\Column(name="id", type="integer")
  21.      * @ORM\Id
  22.      * @ORM\GeneratedValue(strategy="AUTO")
  23.      */
  24.     protected $id;
  25.     /**
  26.      * Many PriceOptimized have One Product
  27.      * @var ConfirmedProduct $product
  28.      * @ORM\ManyToOne(targetEntity="App\Entity\Product\ConfirmedProduct", inversedBy="optimizedPrices", cascade={"persist"})
  29.      * @ORM\JoinColumn(name="product_id", referencedColumnName="id")
  30.      * @Assert\NotBlank()
  31.      * @Assert\Type("App\Entity\Product\ConfirmedProduct")
  32.      */
  33.     protected $product;
  34.     /**
  35.      * Many PriceOptimized have One Customer
  36.      * @var Customer $customer
  37.      * @ORM\ManyToOne(targetEntity="App\Entity\Customer", inversedBy="optimizedPrices")
  38.      * @ORM\JoinColumn(name="customer_id", referencedColumnName="id")
  39.      * @Assert\NotBlank()
  40.      */
  41.     protected $customer;
  42.     /**
  43.      * @var DateTime
  44.      *
  45.      * @ORM\Column(name="start", type="datetime", nullable=false)
  46.      */
  47.     protected $start;
  48.     /**
  49.      * @var DateTime
  50.      *
  51.      * @ORM\Column(name="end", type="datetime", nullable=false)
  52.      */
  53.     protected $end;
  54.     /**
  55.      * @var float
  56.      *
  57.      * @ORM\Column(name="price", type="float", nullable=false)
  58.      */
  59.     protected $price;
  60.     public function __clone()
  61.     {
  62.         $this->id null;
  63.     }
  64.     /**
  65.      * @return int
  66.      */
  67.     public function getId()
  68.     {
  69.         return $this->id;
  70.     }
  71.     /**
  72.      * @param int $id
  73.      */
  74.     public function setId($id)
  75.     {
  76.         $this->id $id;
  77.     }
  78.     /**
  79.      * @return mixed
  80.      */
  81.     public function getProduct()
  82.     {
  83.         return $this->product;
  84.     }
  85.     /**
  86.      * @param mixed $product
  87.      */
  88.     public function setProduct(ConfirmedProduct $product)
  89.     {
  90.         $this->product $product;
  91.     }
  92.     /**
  93.      * @return mixed
  94.      */
  95.     public function getCustomer()
  96.     {
  97.         return $this->customer;
  98.     }
  99.     /**
  100.      * @param mixed $customer
  101.      */
  102.     public function setCustomer($customer)
  103.     {
  104.         $this->customer $customer;
  105.     }
  106.     /**
  107.      * @return DateTime
  108.      */
  109.     public function getStart()
  110.     {
  111.         return $this->start;
  112.     }
  113.     /**
  114.      * @param DateTime $start
  115.      */
  116.     public function setStart($start)
  117.     {
  118.         $start->setTime(000);
  119.         $this->start $start;
  120.     }
  121.     /**
  122.      * @return DateTime
  123.      */
  124.     public function getEnd()
  125.     {
  126.         return $this->end;
  127.     }
  128.     /**
  129.      * @param DateTime $end
  130.      */
  131.     public function setEnd($end)
  132.     {
  133.         $end->setTime(000);
  134.         $this->end $end;
  135.     }
  136.     /**
  137.      * @return float
  138.      */
  139.     public function getPrice()
  140.     {
  141.         return $this->price;
  142.     }
  143.     /**
  144.      * @param float $price
  145.      */
  146.     public function setPrice($price)
  147.     {
  148.         $this->price $price;
  149.     }
  150.     public function getCustomerId()
  151.     {
  152.         return $this->customer->getId();
  153.     }
  154. }