<?php
namespace CoreBundle\Entity\Vehicles;
use Doctrine\Common\Collections\ArrayCollection;
use Application\Sonata\MediaBundle\Entity\Media;
use Application\Sonata\MediaBundle\Entity\Gallery;
use CoreBundle\Entity\User;
use CoreBundle\Entity\Dealer;
use CoreBundle\Entity\Model;
use CoreBundle\Entity\Post;
use DateTime;
use CoreBundle\Entity\AutoRiaOptions;
use Doctrine\Common\Collections\Collection;
/**
* Vehicle
*/
class Vehicle
{
/**
* @var integer
*/
private $id;
/**
* @var integer
*/
private $temp_id;
/**
* @var string
*/
private $admin_name;
/**
* @var DateTime
*/
private $date_create;
/**
* @var integer
*/
private $vehicle_type;
/**
* @var string
*/
private $url;
/**
* @var string
*/
private $vin;
/**
* @var integer
*/
private $state = 1;
/**
* @var integer
*/
private $show_disabled;
/**
* @var integer
*/
private $position = 0;
/**
* @var string
*/
private $test_drive = 0;
/**
* @var integer
*/
private $credit_available = 0;
/**
* @var integer
*/
private $recommend;
/**
* @var integer
*/
private $is_new_model;
/**
* @var integer
*/
private $is_used = 0;
/**
* @var integer
*/
private $has_nds = 0;
/**
* @var Media
*/
private $image;
/**
* @var Media
*/
private $preview;
/**
* @var Media
*/
private $preview_second;
/**
* @var Gallery
*/
private $gallery;
/**
* @var Gallery
*/
private $video;
/**
* @var VehicleCardType|null
*/
private $vehicleCardType;
/**
* @var Collection
*/
private $files;
/**
* @var Collection
*/
private $content;
/**
* @var Collection
*/
private $equipments;
/**
* @var Collection
*/
private $features;
/**
* @var Collection
*/
private $variations;
/**
* @var User
*/
private $creator;
/**
* @var Dealer
*/
private $dealer;
/**
* @var Model
*/
private $model;
/**
* @var Category
*/
private $category;
/**
* @var Group
*/
private $group;
/**
* @var Collection
*/
private $posts;
/**
* @var Collection
*/
private $colors;
/**
* @var Collection
*/
private $interiers;
/**
* @var Collection
*/
private $vehicle_items;
/**
* @var integer
*/
private $ria_level;
/**
* @var integer
*/
private $ria_period;
/**
* @var DateTime
*/
private $ria_publication_date;
/**
* @var DateTime
*/
private $ria_top_publication_date;
/**
* @var integer
*/
private $ria_is_notified;
/**
* @var string
*/
private $crm_id;
/**
* @var integer
*/
private $is_not_filled = 0;
/**
* @var integer
*/
private $is_pre_order = 0;
/**
* @var Collection
*/
private $boat_engine;
/**
* @var Collection
*/
private $auto_ria_options;
private DateTime $updatedAt;
/**
* @var Collection
*/
private $vehicle_auto_ria_options;
/**
* Constructor
*/
public function __construct()
{
$this->files = new ArrayCollection();
$this->content = new ArrayCollection();
$this->equipments = new ArrayCollection();
$this->features = new ArrayCollection();
$this->vehicle_items = new ArrayCollection();
$this->variations = new ArrayCollection();
$this->posts = new ArrayCollection();
$this->faqs = new ArrayCollection();
$this->content->add((new VehicleContent())->setLanguage('ru')->setVehicle($this));
$this->content->add((new VehicleContent())->setLanguage('ua')->setVehicle($this));
}
public function __sleep()
{
return ['content', 'equipments', 'variations', 'vehicle_items', 'state'];
}
public function prepareDataForSerialization()
{
$data = [
'content' => [
'ru' => $this->getContentByLocale('ru'),
'ua' => $this->getContentByLocale('ua'),
],
'equipments' => [],
'variations' => [],
'items' => [],
];
foreach ($this->getArrayEquipments() as $equipment) {
$data['equipments'][] = ['id' => $equipment->getId(), 'title' => $equipment->getTitle()];
}
foreach ($this->getArrayVariations() as $variation) {
$data['variations'][] = ['id' => $variation->getId(), 'title' => $variation->getTitle()];
}
foreach ($this->getArrayVehicleItems() as $vehicleItem) {
$data['items'][] = [
'id' => $vehicleItem->getId(),
'equipment' => $vehicleItem->getEquipment() ? $vehicleItem->getEquipment()->getId() : null,
'variation' => $vehicleItem->getVariation() ? $vehicleItem->getVariation()->getId() : null,
'price' => $vehicleItem->getPrice(),
'PreorderPrice' => $vehicleItem->getPreorderPrice(),
'PriceWithPDV' => $vehicleItem->getPriceWithPDV(),
'SpecifyPrice' => $vehicleItem->getSpecifyPrice(),
'AltPrice' => $vehicleItem->getAltPrice(),
'BestPrice' => $vehicleItem->getBestPrice(),
'RentPrice' => $vehicleItem->getRentPrice(),
'AltUsdPrice' => $vehicleItem->getAltUsdPrice(),
'AltRate' => $vehicleItem->getAltRate(),
];
}
$data['state'] = $this->getState();
return $data;
}
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set tempId
*
* @param integer $tempId
*
* @return Vehicle
*/
public function setTempId($tempId)
{
$this->temp_id = $tempId;
return $this;
}
/**
* Get tempId
*
* @return integer
*/
public function getTempId()
{
return $this->temp_id;
}
/**
* Set dateCreate
*
* @param DateTime $dateCreate
*
* @return Vehicle
*/
public function setDateCreate($dateCreate)
{
$this->date_create = $dateCreate;
return $this;
}
/**
* Get dateCreate
*
* @return DateTime
*/
public function getDateCreate()
{
return $this->date_create;
}
/**
* Set vehicleType
*
* @param integer $vehicleType
*
* @return Vehicle
*/
public function setVehicleType($vehicleType)
{
$this->vehicle_type = $vehicleType;
return $this;
}
/**
* Get vehicleType
*
* @return integer
*/
public function getVehicleType()
{
return $this->vehicle_type;
}
/**
* Set url
*
* @param string $url
*
* @return Vehicle
*/
public function setUrl($url)
{
$this->url = $url;
return $this;
}
/**
* Get url
*
* @return string
*/
public function getUrl()
{
return $this->url;
}
/**
* Set vin
*
* @param string $vin
*
* @return Vehicle
*/
public function setVin($vin)
{
$this->vin = $vin;
return $this;
}
/**
* Get vin
*
* @return string
*/
public function getVin()
{
return $this->vin;
}
/**
* Set state
*
* @param integer $state
*
* @return Vehicle
*/
public function setState($state)
{
$this->state = $state;
return $this;
}
/**
* Get state
*
* @return integer
*/
public function getState()
{
return $this->state > 0;
}
/**
* Set showDisabled
*
* @param integer $showDisabled
*
* @return Vehicle
*/
public function setShowDisabled($showDisabled)
{
$this->show_disabled = $showDisabled;
return $this;
}
/**
* Get showDisabled
*
* @return integer
*/
public function getShowDisabled()
{
return $this->show_disabled > 0;
}
/**
* Set position
*
* @param integer $position
*
* @return Vehicle
*/
public function setPosition($position)
{
$this->position = $position;
return $this;
}
/**
* Get position
*
* @return integer
*/
public function getPosition()
{
return $this->position;
}
/**
* Set testDrive
*
* @param string $testDrive
*
* @return Vehicle
*/
public function setTestDrive($testDrive)
{
$this->test_drive = $testDrive;
return $this;
}
/**
* Get testDrive
*
* @return string
*/
public function getTestDrive()
{
return $this->test_drive > 0;
}
/**
* Set creditAvailable
*
* @param integer $creditAvailable
*
* @return Vehicle
*/
public function setCreditAvailable($creditAvailable)
{
$this->credit_available = $creditAvailable;
return $this;
}
/**
* Get creditAvailable
*
* @return integer
*/
public function getCreditAvailable()
{
return $this->credit_available > 0;
}
/**
* Set recommend
*
* @param integer $recommend
*
* @return Vehicle
*/
public function setRecommend($recommend)
{
$this->recommend = $recommend;
return $this;
}
/**
* Get recommend
*
* @return integer
*/
public function getRecommend()
{
return $this->recommend > 0;
}
/**
* Set isNewModel
*
* @param integer $isNewModel
*
* @return Vehicle
*/
public function setIsNewModel($isNewModel)
{
$this->is_new_model = $isNewModel;
return $this;
}
/**
* Get isNewModel
*
* @return integer
*/
public function getIsNewModel()
{
return $this->is_new_model > 0;
}
/**
* Set isUsed
*
* @param integer $isUsed
*
* @return Vehicle
*/
public function setIsUsed($isUsed)
{
$this->is_used = $isUsed;
return $this;
}
/**
* Get isUsed
*
* @return integer
*/
public function getIsUsed()
{
return $this->is_used > 0;
}
/**
* Set hasNds
*
* @param integer $hasNds
*
* @return Vehicle
*/
public function setHasNds($hasNds)
{
$this->has_nds = $hasNds;
return $this;
}
/**
* Get hasNds
*
* @return integer
*/
public function getHasNds()
{
return $this->has_nds > 0;
}
/**
* Set image
*
* @param Media $image
*
* @return Vehicle
*/
public function setImage(Media $image = null)
{
$this->image = $image;
return $this;
}
/**
* Get image
*
* @return Media
*/
public function getImage()
{
return $this->image;
}
/**
* Set preview
*
* @param Media $preview
*
* @return Vehicle
*/
public function setPreview(Media $preview = null)
{
$this->preview = $preview;
return $this;
}
/**
* Get preview
*
* @return Media
*/
public function getPreview()
{
return $this->preview;
}
/**
* Set previewSecond
*
* @param Media $previewSecond
*
* @return Vehicle
*/
public function setPreviewSecond(Media $previewSecond = null)
{
$this->preview_second = $previewSecond;
return $this;
}
/**
* Get previewSecond
*
* @return Media
*/
public function getPreviewSecond()
{
return $this->preview_second;
}
/**
* Set gallery
*
* @param Gallery $gallery
*
* @return Vehicle
*/
public function setGallery(Gallery $gallery = null)
{
$this->gallery = $gallery;
return $this;
}
/**
* Get gallery
*
* @return Gallery
*/
public function getGallery()
{
return $this->gallery;
}
/**
* Set video
*
* @param Gallery $video
*
* @return Vehicle
*/
public function setVideo(Gallery $video = null)
{
$this->video = $video;
return $this;
}
/**
* Get video
*
* @return Gallery
*/
public function getVideo()
{
return $this->video;
}
/**
* Add file
*
* @param VehicleFile $file
*
* @return Vehicle
*/
public function addFile(VehicleFile $file)
{
$this->files[] = $file;
return $this;
}
/**
* Remove file
*
* @param VehicleFile $file
*/
public function removeFile(VehicleFile $file)
{
$this->files->removeElement($file);
}
/**
* Get files
*
* @return Collection
*/
public function getFiles()
{
return $this->files;
}
/**
* Add content
*
* @param VehicleContent $content
*
* @return Vehicle
*/
public function addContent(VehicleContent $content)
{
$this->content[] = $content;
return $this;
}
/**
* Remove content
*
* @param VehicleContent $content
*/
public function removeContent(VehicleContent $content)
{
$this->content->removeElement($content);
}
/**
* Get content
*
* @return Collection
*/
public function getContent()
{
return $this->content;
}
/**
* @param $locale
* @return VehicleContent
*/
public function getContentByLocale($locale)
{
foreach ($this->getContent() as $content) {
if($content->getLanguage() == $locale) {
return $content;
}
}
return $this->getContent()->first();
}
/**
* Add equipment
*
* @param Equipment $equipment
*
* @return Vehicle
*/
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 getArrayEquipments()
{
return $this->equipments->toArray();
}
/**
* Add feature
*
* @param Feature $feature
*
* @return Vehicle
*/
public function addFeature(Feature $feature)
{
$this->features[] = $feature;
return $this;
}
/**
* Remove feature
*
* @param Feature $feature
*/
public function removeFeature(Feature $feature)
{
$this->features->removeElement($feature);
}
/**
* Get features
*
* @return Collection
*/
public function getFeatures()
{
return $this->features;
}
/**
* Add variation
*
* @param Variation $variation
*
* @return Vehicle
*/
public function addVariation(Variation $variation)
{
$this->variations[] = $variation;
return $this;
}
/**
* Remove variation
*
* @param Variation $variation
*/
public function removeVariation(Variation $variation)
{
$this->variations->removeElement($variation);
}
/**
* Get variations
*
* @return Collection
*/
public function getVariations()
{
return $this->variations;
}
public function getArrayVariations()
{
return $this->variations->toArray();
}
/**
* Set creator
*
* @param User $creator
*
* @return Vehicle
*/
public function setCreator(User $creator = null)
{
$this->creator = $creator;
return $this;
}
/**
* Get creator
*
* @return User
*/
public function getCreator()
{
return $this->creator;
}
/**
* Set dealer
*
* @param Dealer $dealer
*
* @return Vehicle
*/
public function setDealer(Dealer $dealer = null)
{
$this->dealer = $dealer;
return $this;
}
/**
* Get dealer
*
* @return Dealer
*/
public function getDealer()
{
return $this->dealer;
}
/**
* Set model
*
* @param Model $model
*
* @return Vehicle
*/
public function setModel(Model $model = null)
{
$this->model = $model;
return $this;
}
/**
* Get model
*
* @return Model
*/
public function getModel()
{
return $this->model;
}
/**
* Set category
*
* @param Category $category
*
* @return Vehicle
*/
public function setCategory(Category $category = null)
{
$this->category = $category;
return $this;
}
/**
* Get category
*
* @return Category
*/
public function getCategory()
{
return $this->category;
}
/**
* Set group
*
* @param Group $group
*
* @return Vehicle
*/
public function setGroup(Group $group = null)
{
$this->group = $group;
return $this;
}
/**
* Get group
*
* @return Group
*/
public function getGroup()
{
return $this->group;
}
/**
* Add post
*
* @param Post $post
*
* @return Vehicle
*/
public function addPost(Post $post)
{
$this->posts[] = $post;
return $this;
}
/**
* Remove post
*
* @param Post $post
*/
public function removePost(Post $post)
{
$this->posts->removeElement($post);
}
/**
* Get posts
*
* @return Collection
*/
public function getPosts()
{
return $this->posts;
}
/**
* Set adminName
*
* @param string $adminName
*
* @return Vehicle
*/
public function setAdminName($adminName)
{
$this->admin_name = $adminName;
return $this;
}
/**
* Get adminName
*
* @return string
*/
public function getAdminName()
{
if($this->admin_name) {
return $this->admin_name;
}
if(!$this->getModel()) {
return '';
}
return $this->getModel()->getTitle();
}
public function __toString()
{
$name = $this->getAdminName();
if(!$this->getState()) {
$name .= ' (не активна)';
}
return $name;
}
/**
* Add color
*
* @param ConfiguratorColor $color
*
* @return Vehicle
*/
public function addColor(ConfiguratorColor $color)
{
$this->colors[] = $color;
return $this;
}
/**
* Remove color
*
* @param ConfiguratorColor $color
*/
public function removeColor(ConfiguratorColor $color)
{
$this->colors->removeElement($color);
}
/**
* Get colors
*
* @return Collection
*/
public function getColors()
{
return $this->colors;
}
/**
* Add interier
*
* @param ConfiguratorInterier $interier
*
* @return Vehicle
*/
public function addInterier(ConfiguratorInterier $interier)
{
$this->interiers[] = $interier;
return $this;
}
/**
* Remove interier
*
* @param ConfiguratorInterier $interier
*/
public function removeInterier(ConfiguratorInterier $interier)
{
$this->interiers->removeElement($interier);
}
/**
* Get interiers
*
* @return Collection
*/
public function getInteriers()
{
return $this->interiers;
}
/**
* Add vehicleItem
*
* @param VehicleItem $vehicleItem
*
* @return Vehicle
*/
public function addVehicleItem(VehicleItem $vehicleItem)
{
$this->vehicle_items[] = $vehicleItem;
return $this;
}
/**
* Remove vehicleItem
*
* @param VehicleItem $vehicleItem
*/
public function removeVehicleItem(VehicleItem $vehicleItem)
{
$this->vehicle_items->removeElement($vehicleItem);
}
/**
* Get vehicleItems
*
* @return Collection
*/
public function getVehicleItems()
{
return $this->vehicle_items;
}
public function getArrayVehicleItems()
{
return $this->vehicle_items->toArray();
}
/**
* @var string
*/
private $is_delete = 0;
/**
* Set isDelete
*
* @param string $isDelete
*
* @return Vehicle
*/
public function setIsDelete($isDelete)
{
$this->is_delete = $isDelete;
return $this;
}
/**
* Get isDelete
*
* @return string
*/
public function getIsDelete()
{
return $this->is_delete;
}
/**
* @var string
*/
private $card_js;
/**
* Set cardJs
*
* @param string $cardJs
*
* @return Vehicle
*/
public function setCardJs($cardJs)
{
$this->card_js = $cardJs;
return $this;
}
/**
* Get cardJs
*
* @return string
*/
public function getCardJs()
{
return $this->card_js;
}
private $school_available = 0;
/**
* Set schoolAvailable
*
* @param integer $schoolAvailable
*
* @return Vehicle
*/
public function setSchoolAvailable($schoolAvailable)
{
$this->school_available = $schoolAvailable;
return $this;
}
/**
* Get schoolAvailable
*
* @return integer
*/
public function getSchoolAvailable()
{
return $this->school_available > 0;
}
/**
* @var string
*/
private $ria_id;
/**
* Set riaId
*
* @param string $riaId
*
* @return Vehicle
*/
public function setRiaId($riaId)
{
$this->ria_id = $riaId;
return $this;
}
/**
* Get riaId
*
* @return string
*/
public function getRiaId()
{
return $this->ria_id;
}
/**
* @var Collection
*/
private $recommend_group;
/**
* Add recommendGroup
*
* @param RecommendGroup $recommendGroup
*
* @return Vehicle
*/
public function addRecommendGroup(RecommendGroup $recommendGroup)
{
$this->recommend_group[] = $recommendGroup;
return $this;
}
/**
* Remove recommendGroup
*
* @param RecommendGroup $recommendGroup
*/
public function removeRecommendGroup(RecommendGroup $recommendGroup)
{
$this->recommend_group->removeElement($recommendGroup);
}
/**
* Get recommendGroup
*
* @return Collection
*/
public function getRecommendGroup()
{
return $this->recommend_group;
}
/**
* @var string
*/
private $ria_options;
/**
* Set riaOptions
*
* @param string $riaOptions
*
* @return Vehicle
*/
public function setRiaOptions($riaOptions)
{
$this->ria_options = $riaOptions;
return $this;
}
/**
* Get riaOptions
*
* @return string
*/
public function getRiaOptions()
{
return $this->ria_options;
}
/**
* Set crmId
*
* @param string $crmId
*
* @return Vehicle
*/
public function setCrmId($crmId)
{
$this->crm_id = $crmId;
return $this;
}
/**
* Get crmId
*
* @return string
*/
public function getCrmId()
{
return $this->crm_id;
}
/**
* @return int
*/
public function getIsNotFilled()
{
return $this->is_not_filled;
}
/**
* @param int $is_not_filled
*
* @return Vehicle
*/
public function setIsNotFilled($is_not_filled)
{
$this->is_not_filled = $is_not_filled;
return $this;
}
/**
* @return int
*/
public function getRiaLevel()
{
return $this->ria_level;
}
/**
* @param int $ria_level
*
* @return Vehicle
*/
public function setRiaLevel($ria_level)
{
$this->ria_level = $ria_level;
return $this;
}
/**
* @return int
*/
public function getRiaPeriod()
{
return $this->ria_period;
}
/**
* @param int $ria_period
*
* @return Vehicle
*/
public function setRiaPeriod($ria_period)
{
$this->ria_period = $ria_period;
return $this;
}
/**
* @var integer
*/
private $views;
/**
* Set views
*
* @param integer $views
*
* @return Vehicle
*/
public function setViews($views)
{
$this->views = $views;
return $this;
}
/**
* Get views
*
* @return integer
*/
public function getViews()
{
return $this->views;
}
/**
* @return DateTime
*/
public function getRiaPublicationDate()
{
return $this->ria_publication_date;
}
/**
* @param DateTime $ria_publication_date
*
* @return Vehicle
*/
public function setRiaPublicationDate($ria_publication_date)
{
$this->ria_publication_date = $ria_publication_date;
return $this;
}
/**
* @return DateTime
*/
public function getRiaTopPublicationDate()
{
return $this->ria_top_publication_date;
}
/**
* @param DateTime $ria_top_publication_date
*
* @return Vehicle
*/
public function setRiaTopPublicationDate($ria_top_publication_date)
{
$this->ria_top_publication_date = $ria_top_publication_date;
return $this;
}
/**
* @return int
*/
public function getRiaIsNotified()
{
return $this->ria_is_notified;
}
/**
* @param int $ria_is_notified
*
* @return Vehicle
*/
public function setRiaIsNotified($ria_is_notified)
{
$this->ria_is_notified = $ria_is_notified;
return $this;
}
public function getDays()
{
$days = 1;
if ($this->date_create) {
$days = (new DateTime('now'))->diff($this->date_create)->days;
$days = $days < 1 ? 1 : $days;
}
return $days;
}
public function getAdminViews()
{
$perDays = ceil($this->views / $this->getDays()) ;
return ((int) $this->views).' / '.$perDays;
}
/**
* @var Collection
*/
private $faqs;
/**
* Add faq
*
* @param Faq $faq
*
* @return Vehicle
*/
public function addFaq(Faq $faq)
{
$this->faqs[] = $faq;
return $this;
}
/**
* Remove faq
*
* @param Faq $faq
*/
public function removeFaq(Faq $faq)
{
$this->faqs->removeElement($faq);
}
/**
* Get faq
*
* @return Collection
*/
public function getFaqs()
{
return $this->faqs;
}
/**
* Set isPreOrder
*
* @param integer $isPreOrder
*
* @return Vehicle
*/
public function setIsPreOrder($isPreOrder)
{
$this->is_pre_order = $isPreOrder;
return $this;
}
/**
* Get isPreOrder
*
* @return integer
*/
public function getIsPreOrder()
{
return $this->is_pre_order > 0;
}
/**
* Add boatEngine
*
* @param \CoreBundle\Entity\Vehicles\Vehicle $boatEngine
*
* @return Vehicle
*/
public function addBoatEngine(\CoreBundle\Entity\Vehicles\Vehicle $boatEngine)
{
$this->boat_engine[] = $boatEngine;
return $this;
}
/**
* Remove boatEngine
*
* @param \CoreBundle\Entity\Vehicles\Vehicle $boatEngine
*/
public function removeBoatEngine(\CoreBundle\Entity\Vehicles\Vehicle $boatEngine)
{
$this->boat_engine->removeElement($boatEngine);
}
/**
* Get boatEngine
*
* @return Collection
*/
public function getBoatEngine()
{
return $this->boat_engine;
}
/**
* @var boolean
*/
private $noindex_follow = false;
/**
* Set noindexFollow
*
* @param boolean $noindexFollow
*
* @return Vehicle
*/
public function setNoindexFollow($noindexFollow)
{
$this->noindex_follow = $noindexFollow;
return $this;
}
/**
* Get noindexFollow
*
* @return boolean
*/
public function getNoindexFollow()
{
return $this->noindex_follow;
}
/**
* @var Collection
*/
private $categories;
/**
* Add category.
*
* @param Category $category
*
* @return Vehicle
*/
public function addCategory(Category $category)
{
$this->categories[] = $category;
return $this;
}
/**
* Remove category.
*
* @param Category $category
*
* @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
*/
public function removeCategory(Category $category)
{
return $this->categories->removeElement($category);
}
/**
* Get categories.
*
* @return Collection
*/
public function getCategories()
{
return $this->categories;
}
/**
* Add autoRiaOption.
*
* @param AutoRiaOptions $autoRiaOption
* @param bool $isShow
* @return Vehicle
*/
public function addAutoRiaOption(AutoRiaOptions $autoRiaOption, bool $isShow = true): self
{
foreach ($this->vehicle_auto_ria_options as $relation) {
if ($relation->getOption() === $autoRiaOption) {
$relation->setIsShowInPdf($isShow);
return $this;
}
}
$relation = new VehicleAutoRiaOption();
$relation->setVehicle($this);
$relation->setOption($autoRiaOption);
$relation->setIsShowInPdf($isShow);
$this->vehicle_auto_ria_options[] = $relation;
return $this;
}
/**
* Remove autoRiaOption.
*
* @param AutoRiaOptions $autoRiaOption
*
* @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
*/
public function removeAutoRiaOption(AutoRiaOptions $autoRiaOption): bool
{
foreach ($this->vehicle_auto_ria_options as $key => $relation) {
if ($relation->getOption() === $autoRiaOption) {
$this->vehicle_auto_ria_options->remove($key);
return true;
}
}
return false;
}
/**
* Get autoRiaOption.
*
* @return Collection
*/
public function getAutoRiaOptions(): Collection
{
if (is_null($this->vehicle_auto_ria_options)) {
return new ArrayCollection();
}
return $this->vehicle_auto_ria_options->map(function(VehicleAutoRiaOption $relation) {
return $relation->getOption();
});
}
/**
* @return Collection|VehicleAutoRiaOption[]
*/
public function getVehicleAutoRiaOptions(): ?Collection
{
if (is_null($this->vehicle_auto_ria_options)){
return new ArrayCollection();
}
return $this->vehicle_auto_ria_options;
}
public function addVehicleAutoRiaOption(VehicleAutoRiaOption $option)
{
if (!$this->vehicle_auto_ria_options->contains($option)) {
$option->setVehicle($this);
$this->vehicle_auto_ria_options[] = $option;
}
}
public function removeVehicleAutoRiaOption(VehicleAutoRiaOption $option)
{
if ($this->vehicle_auto_ria_options->contains($option)) {
$this->vehicle_auto_ria_options->removeElement($option);
$option->setVehicle(null);
}
}
public function setVehicleCardType(?VehicleCardType $vehicleCardType): Vehicle
{
$this->vehicleCardType = $vehicleCardType;
if ($vehicleCardType !== null) {
$vehicleCardType->setVehicle($this);
}
return $this;
}
public function getVehicleCardType(): ?VehicleCardType
{
return $this->vehicleCardType;
}
public function getUpdatedAt(): DateTime
{
return $this->updatedAt;
}
public function setUpdatedAt(): self
{
$this->updatedAt = new \DateTime();
return $this;
}
}