src/CoreBundle/Entity/Vehicles/EquipmentOptions.php line 8

Open in your IDE?
  1. <?php
  2. namespace CoreBundle\Entity\Vehicles;
  3. /**
  4.  * EquipmentOptions
  5.  */
  6. class EquipmentOptions
  7. {
  8.     /**
  9.      * @var integer
  10.      */
  11.     private $id;
  12.     /**
  13.      * @var float
  14.      */
  15.     private $price;
  16.     /**
  17.      * @var float
  18.      */
  19.     private $price_usd;
  20.     /**
  21.      * @var string
  22.      */
  23.     private $value_ua;
  24.     /**
  25.      * @var string
  26.      */
  27.     private $value_ru;
  28.     /**
  29.      * @var integer
  30.      */
  31.     private $is_optional;
  32.     /**
  33.      * @var Equipment
  34.      */
  35.     private $equipment;
  36.     /**
  37.      * @var EquipmentOption
  38.      */
  39.     private $option;
  40.     /**
  41.      * @var integer
  42.      */
  43.     private $sort;
  44.     public function __clone() {
  45.         $this->id null;
  46.     }
  47.     /**
  48.      * Get id
  49.      *
  50.      * @return integer
  51.      */
  52.     public function getId()
  53.     {
  54.         return $this->id;
  55.     }
  56.     /**
  57.      * Set price
  58.      *
  59.      * @param float $price
  60.      *
  61.      * @return EquipmentOptions
  62.      */
  63.     public function setPrice($price)
  64.     {
  65.         $this->price $price;
  66.         return $this;
  67.     }
  68.     /**
  69.      * Get price
  70.      *
  71.      * @return float
  72.      */
  73.     public function getPrice()
  74.     {
  75.         return $this->price;
  76.     }
  77.     /**
  78.      * Set priceUsd
  79.      *
  80.      * @param float $priceUsd
  81.      *
  82.      * @return EquipmentOptions
  83.      */
  84.     public function setPriceUsd($priceUsd)
  85.     {
  86.         $this->price_usd $priceUsd;
  87.         return $this;
  88.     }
  89.     /**
  90.      * Get priceUsd
  91.      *
  92.      * @return float
  93.      */
  94.     public function getPriceUsd()
  95.     {
  96.         return $this->price_usd;
  97.     }
  98.     /**
  99.      * Set valueUa
  100.      *
  101.      * @param string $valueUa
  102.      *
  103.      * @return EquipmentOptions
  104.      */
  105.     public function setValueUa($valueUa)
  106.     {
  107.         $this->value_ua $valueUa;
  108.         return $this;
  109.     }
  110.     /**
  111.      * Get valueUa
  112.      *
  113.      * @return string
  114.      */
  115.     public function getValueUa()
  116.     {
  117.         return $this->value_ua;
  118.     }
  119.     /**
  120.      * Set valueRu
  121.      *
  122.      * @param string $valueRu
  123.      *
  124.      * @return EquipmentOptions
  125.      */
  126.     public function setValueRu($valueRu)
  127.     {
  128.         $this->value_ru $valueRu;
  129.         return $this;
  130.     }
  131.     /**
  132.      * Get valueRu
  133.      *
  134.      * @return string
  135.      */
  136.     public function getValueRu()
  137.     {
  138.         return $this->value_ru;
  139.     }
  140.     public function getValue($locale)
  141.     {
  142.         return $locale == 'ru' $this->getValueRu() : $this->getValueUa();
  143.     }
  144.     public function price()
  145.     {
  146.         if($this->getPrice()) {
  147.             return $this->getPrice();
  148.         }
  149.         if($this->getPriceUsd()) {
  150.             $rate $this->getEquipment()->getVehicle()->getDealer()->getRate();
  151.             return ceil($rate $this->getPriceUsd());
  152.         }
  153.         return 0;
  154.     }
  155.     /**
  156.      * Set isOptional
  157.      *
  158.      * @param integer $isOptional
  159.      *
  160.      * @return EquipmentOptions
  161.      */
  162.     public function setIsOptional($isOptional)
  163.     {
  164.         $this->is_optional $isOptional;
  165.         return $this;
  166.     }
  167.     /**
  168.      * Get isOptional
  169.      *
  170.      * @return integer
  171.      */
  172.     public function getIsOptional()
  173.     {
  174.         return $this->is_optional;
  175.     }
  176.     /**
  177.      * Set equipment
  178.      *
  179.      * @param Equipment $equipment
  180.      *
  181.      * @return EquipmentOptions
  182.      */
  183.     public function setEquipment(Equipment $equipment null)
  184.     {
  185.         $this->equipment $equipment;
  186.         return $this;
  187.     }
  188.     /**
  189.      * Get equipment
  190.      *
  191.      * @return Equipment
  192.      */
  193.     public function getEquipment()
  194.     {
  195.         return $this->equipment;
  196.     }
  197.     /**
  198.      * Set option
  199.      *
  200.      * @param EquipmentOption $option
  201.      *
  202.      * @return EquipmentOptions
  203.      */
  204.     public function setOption(EquipmentOption $option null)
  205.     {
  206.         $this->option $option;
  207.         return $this;
  208.     }
  209.     /**
  210.      * Get option
  211.      *
  212.      * @return EquipmentOption
  213.      */
  214.     public function getOption()
  215.     {
  216.         return $this->option;
  217.     }
  218.     public function __toString()
  219.     {
  220.         return $this->option->getTitleRu();
  221.     }
  222.     /**
  223.      * @var integer
  224.      */
  225.     private $show_in_catalog;
  226.     /**
  227.      * Set showInCatalog
  228.      *
  229.      * @param integer $showInCatalog
  230.      *
  231.      * @return EquipmentOptions
  232.      */
  233.     public function setShowInCatalog($showInCatalog)
  234.     {
  235.         $this->show_in_catalog $showInCatalog;
  236.         return $this;
  237.     }
  238.     /**
  239.      * Get showInCatalog
  240.      *
  241.      * @return integer
  242.      */
  243.     public function getShowInCatalog()
  244.     {
  245.         return $this->show_in_catalog;
  246.     }
  247.     public function getSort(): ?int
  248.     {
  249.         return $this->sort;
  250.     }
  251.     public function setSort(?int $sort): self
  252.     {
  253.         $this->sort $sort;
  254.         return $this;
  255.     }
  256. }