<?phpnamespace CoreBundle\Entity\Vehicles;use Application\Sonata\MediaBundle\Entity\Media;use Application\Sonata\MediaBundle\Entity\Gallery;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;/** * ConfiguratorColor */class ConfiguratorColor{ /** * @var integer */ private $id; /** * @var integer */ private $state; /** * @var string */ private $name_ru; /** * @var string */ private $name_ua; /** * @var integer */ private $price_usd; /** * @var integer */ private $price_uah; /** * @var Media */ private $image; /** * @var Gallery */ private $gallery; /** * @var Vehicle */ private $vehicle; /** * Get id * * @return integer */ public function getId() { return $this->id; } /** * Set state * * @param integer $state * * @return ConfiguratorColor */ public function setState($state) { $this->state = $state; return $this; } /** * Get state * * @return integer */ public function getState() { return $this->state; } /** * Set nameRu * * @param string $nameRu * * @return ConfiguratorColor */ public function setNameRu($nameRu) { $this->name_ru = $nameRu; return $this; } /** * Get nameRu * * @return string */ public function getNameRu() { return $this->name_ru; } /** * Set nameUa * * @param string $nameUa * * @return ConfiguratorColor */ public function setNameUa($nameUa) { $this->name_ua = $nameUa; return $this; } /** * Get nameUa * * @return string */ public function getNameUa() { return $this->name_ua; } public function getName($locale) { return $locale == 'ru' ? $this->name_ru : $this->name_ua; } public function calcPrice() { if($this->getPriceUah()) { return $this->getPriceUah(); } if($this->getPriceUsd()) { $rate = $this->getVehicle()->getDealer()->getRate(); return ceil($rate*$this->getPriceUsd()); } return 0; } /** * Set priceUsd * * @param integer $priceUsd * * @return ConfiguratorColor */ public function setPriceUsd($priceUsd) { $this->price_usd = $priceUsd; return $this; } /** * Get priceUsd * * @return integer */ public function getPriceUsd() { return $this->price_usd; } /** * Set priceUah * * @param integer $priceUah * * @return ConfiguratorColor */ public function setPriceUah($priceUah) { $this->price_uah = $priceUah; return $this; } /** * Get priceUah * * @return integer */ public function getPriceUah() { return $this->price_uah; } /** * Set image * * @param Media $image * * @return ConfiguratorColor */ public function setImage(Media $image = null) { $this->image = $image; return $this; } /** * Get image * * @return Media */ public function getImage() { return $this->image; } /** * Set gallery * * @param Gallery $gallery * * @return ConfiguratorColor */ public function setGallery(Gallery $gallery = null) { $this->gallery = $gallery; return $this; } /** * Get gallery * * @return Gallery */ public function getGallery() { return $this->gallery; } /** * Set vehicle * * @param Vehicle $vehicle * * @return ConfiguratorColor */ public function setVehicle(Vehicle $vehicle = null) { $this->vehicle = $vehicle; return $this; } /** * Get vehicle * * @return Vehicle */ public function getVehicle() { return $this->vehicle; } public function __toString() { return (string) $this->getNameRu(); } /** * @var Collection */ private $equipments; /** * Constructor */ public function __construct() { $this->equipments = new ArrayCollection(); } /** * Add equipment * * @param Equipment $equipment * * @return ConfiguratorColor */ public function addEquipment(Equipment $equipment) { $this->equipments[] = $equipment; return $this; } /** * Remove equipment * * @param Equipment $equipment */ public function removeEquipment(Equipment $equipment) { $this->equipments->removeElement($equipment); } /** * Get equipments * * @return Collection */ public function getEquipments() { return $this->equipments; } public function clearEquipments() { $this->equipments->clear(); }}