<?phpnamespace CoreBundle\Entity\Vehicles;/** * EquipmentOptions */class EquipmentOptions{ /** * @var integer */ private $id; /** * @var float */ private $price; /** * @var float */ private $price_usd; /** * @var string */ private $value_ua; /** * @var string */ private $value_ru; /** * @var integer */ private $is_optional; /** * @var Equipment */ private $equipment; /** * @var EquipmentOption */ private $option; /** * @var integer */ private $sort; public function __clone() { $this->id = null; } /** * Get id * * @return integer */ public function getId() { return $this->id; } /** * Set price * * @param float $price * * @return EquipmentOptions */ public function setPrice($price) { $this->price = $price; return $this; } /** * Get price * * @return float */ public function getPrice() { return $this->price; } /** * Set priceUsd * * @param float $priceUsd * * @return EquipmentOptions */ public function setPriceUsd($priceUsd) { $this->price_usd = $priceUsd; return $this; } /** * Get priceUsd * * @return float */ public function getPriceUsd() { return $this->price_usd; } /** * Set valueUa * * @param string $valueUa * * @return EquipmentOptions */ public function setValueUa($valueUa) { $this->value_ua = $valueUa; return $this; } /** * Get valueUa * * @return string */ public function getValueUa() { return $this->value_ua; } /** * Set valueRu * * @param string $valueRu * * @return EquipmentOptions */ public function setValueRu($valueRu) { $this->value_ru = $valueRu; return $this; } /** * Get valueRu * * @return string */ public function getValueRu() { return $this->value_ru; } public function getValue($locale) { return $locale == 'ru' ? $this->getValueRu() : $this->getValueUa(); } public function price() { if($this->getPrice()) { return $this->getPrice(); } if($this->getPriceUsd()) { $rate = $this->getEquipment()->getVehicle()->getDealer()->getRate(); return ceil($rate * $this->getPriceUsd()); } return 0; } /** * Set isOptional * * @param integer $isOptional * * @return EquipmentOptions */ public function setIsOptional($isOptional) { $this->is_optional = $isOptional; return $this; } /** * Get isOptional * * @return integer */ public function getIsOptional() { return $this->is_optional; } /** * Set equipment * * @param Equipment $equipment * * @return EquipmentOptions */ public function setEquipment(Equipment $equipment = null) { $this->equipment = $equipment; return $this; } /** * Get equipment * * @return Equipment */ public function getEquipment() { return $this->equipment; } /** * Set option * * @param EquipmentOption $option * * @return EquipmentOptions */ public function setOption(EquipmentOption $option = null) { $this->option = $option; return $this; } /** * Get option * * @return EquipmentOption */ public function getOption() { return $this->option; } public function __toString() { return $this->option->getTitleRu(); } /** * @var integer */ private $show_in_catalog; /** * Set showInCatalog * * @param integer $showInCatalog * * @return EquipmentOptions */ public function setShowInCatalog($showInCatalog) { $this->show_in_catalog = $showInCatalog; return $this; } /** * Get showInCatalog * * @return integer */ public function getShowInCatalog() { return $this->show_in_catalog; } public function getSort(): ?int { return $this->sort; } public function setSort(?int $sort): self { $this->sort = $sort; return $this; }}