src/CoreBundle/Entity/Vehicles/Vehicle.php line 19

Open in your IDE?
  1. <?php
  2. namespace CoreBundle\Entity\Vehicles;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Application\Sonata\MediaBundle\Entity\Media;
  5. use Application\Sonata\MediaBundle\Entity\Gallery;
  6. use CoreBundle\Entity\User;
  7. use CoreBundle\Entity\Dealer;
  8. use CoreBundle\Entity\Model;
  9. use CoreBundle\Entity\Post;
  10. use DateTime;
  11. use CoreBundle\Entity\AutoRiaOptions;
  12. use Doctrine\Common\Collections\Collection;
  13. /**
  14.  * Vehicle
  15.  */
  16. class Vehicle
  17. {
  18.     /**
  19.      * @var integer
  20.      */
  21.     private $id;
  22.     /**
  23.      * @var integer
  24.      */
  25.     private $temp_id;
  26.     /**
  27.      * @var string
  28.      */
  29.     private $admin_name;
  30.     /**
  31.      * @var DateTime
  32.      */
  33.     private $date_create;
  34.     /**
  35.      * @var integer
  36.      */
  37.     private $vehicle_type;
  38.     /**
  39.      * @var string
  40.      */
  41.     private $url;
  42.     /**
  43.      * @var string
  44.      */
  45.     private $vin;
  46.     /**
  47.      * @var integer
  48.      */
  49.     private $state 1;
  50.     /**
  51.      * @var integer
  52.      */
  53.     private $show_disabled;
  54.     /**
  55.      * @var integer
  56.      */
  57.     private $position 0;
  58.     /**
  59.      * @var string
  60.      */
  61.     private $test_drive 0;
  62.     /**
  63.      * @var integer
  64.      */
  65.     private $credit_available 0;
  66.     /**
  67.      * @var integer
  68.      */
  69.     private $recommend;
  70.     /**
  71.      * @var integer
  72.      */
  73.     private $is_new_model;
  74.     /**
  75.      * @var integer
  76.      */
  77.     private $is_used 0;
  78.     /**
  79.      * @var integer
  80.      */
  81.     private $has_nds 0;
  82.     /**
  83.      * @var Media
  84.      */
  85.     private $image;
  86.     /**
  87.      * @var Media
  88.      */
  89.     private $preview;
  90.     /**
  91.      * @var Media
  92.      */
  93.     private $preview_second;
  94.     /**
  95.      * @var Gallery
  96.      */
  97.     private $gallery;
  98.     /**
  99.      * @var Gallery
  100.      */
  101.     private $video;
  102.     /**
  103.      * @var VehicleCardType|null
  104.      */
  105.     private $vehicleCardType;
  106.     /**
  107.      * @var Collection
  108.      */
  109.     private $files;
  110.     /**
  111.      * @var Collection
  112.      */
  113.     private $content;
  114.     /**
  115.      * @var Collection
  116.      */
  117.     private $equipments;
  118.     /**
  119.      * @var Collection
  120.      */
  121.     private $features;
  122.     /**
  123.      * @var Collection
  124.      */
  125.     private $variations;
  126.     /**
  127.      * @var User
  128.      */
  129.     private $creator;
  130.     /**
  131.      * @var Dealer
  132.      */
  133.     private $dealer;
  134.     /**
  135.      * @var Model
  136.      */
  137.     private $model;
  138.     /**
  139.      * @var Category
  140.      */
  141.     private $category;
  142.     /**
  143.      * @var Group
  144.      */
  145.     private $group;
  146.     /**
  147.      * @var Collection
  148.      */
  149.     private $posts;
  150.     /**
  151.      * @var Collection
  152.      */
  153.     private $colors;
  154.     /**
  155.      * @var Collection
  156.      */
  157.     private $interiers;
  158.     /**
  159.      * @var Collection
  160.      */
  161.     private $vehicle_items;
  162.     /**
  163.      * @var integer
  164.      */
  165.     private $ria_level;
  166.     /**
  167.      * @var integer
  168.      */
  169.     private $ria_period;
  170.     /**
  171.      * @var DateTime
  172.      */
  173.     private $ria_publication_date;
  174.     /**
  175.      * @var DateTime
  176.      */
  177.     private $ria_top_publication_date;
  178.     /**
  179.      * @var integer
  180.      */
  181.     private $ria_is_notified;
  182.     /**
  183.      * @var string
  184.      */
  185.     private $crm_id;
  186.     /**
  187.      * @var integer
  188.      */
  189.     private $is_not_filled 0;
  190.     /**
  191.      * @var integer
  192.      */
  193.     private $is_pre_order 0;
  194.     /**
  195.      * @var Collection
  196.      */
  197.     private $boat_engine;
  198.     /**
  199.      * @var Collection
  200.      */
  201.     private $auto_ria_options;
  202.     private DateTime $updatedAt;
  203.     /**
  204.      * @var Collection
  205.      */
  206.     private $vehicle_auto_ria_options;
  207.     /**
  208.      * Constructor
  209.      */
  210.     public function __construct()
  211.     {
  212.         $this->files = new ArrayCollection();
  213.         $this->content = new ArrayCollection();
  214.         $this->equipments = new ArrayCollection();
  215.         $this->features = new ArrayCollection();
  216.         $this->vehicle_items = new ArrayCollection();
  217.         $this->variations = new ArrayCollection();
  218.         $this->posts = new ArrayCollection();
  219.         $this->faqs = new ArrayCollection();
  220.         $this->content->add((new VehicleContent())->setLanguage('ru')->setVehicle($this));
  221.         $this->content->add((new VehicleContent())->setLanguage('ua')->setVehicle($this));
  222.     }
  223.     public function __sleep()
  224.     {
  225.         return ['content''equipments''variations''vehicle_items''state'];
  226.     }
  227.     public function prepareDataForSerialization()
  228.     {
  229.         $data = [
  230.             'content' => [
  231.                 'ru' => $this->getContentByLocale('ru'),
  232.                 'ua' => $this->getContentByLocale('ua'),
  233.             ],
  234.             'equipments' => [],
  235.             'variations' => [],
  236.             'items' => [],
  237.         ];
  238.         foreach ($this->getArrayEquipments() as $equipment) {
  239.             $data['equipments'][] = ['id' => $equipment->getId(), 'title' => $equipment->getTitle()];
  240.         }
  241.         foreach ($this->getArrayVariations() as $variation) {
  242.             $data['variations'][] = ['id' => $variation->getId(), 'title' => $variation->getTitle()];
  243.         }
  244.         foreach ($this->getArrayVehicleItems() as $vehicleItem) {
  245.             $data['items'][] = [
  246.                 'id' => $vehicleItem->getId(),
  247.                 'equipment' => $vehicleItem->getEquipment() ? $vehicleItem->getEquipment()->getId() : null,
  248.                 'variation' => $vehicleItem->getVariation() ? $vehicleItem->getVariation()->getId() : null,
  249.                 'price' => $vehicleItem->getPrice(),
  250.                 'PreorderPrice' => $vehicleItem->getPreorderPrice(),
  251.                 'PriceWithPDV' => $vehicleItem->getPriceWithPDV(),
  252.                 'SpecifyPrice' => $vehicleItem->getSpecifyPrice(),
  253.                 'AltPrice' => $vehicleItem->getAltPrice(),
  254.                 'BestPrice' => $vehicleItem->getBestPrice(),
  255.                 'RentPrice' => $vehicleItem->getRentPrice(),
  256.                 'AltUsdPrice' => $vehicleItem->getAltUsdPrice(),
  257.                 'AltRate' => $vehicleItem->getAltRate(),
  258.             ];
  259.         }
  260.         $data['state'] = $this->getState();
  261.         return $data;
  262.     }
  263.     /**
  264.      * Get id
  265.      *
  266.      * @return integer
  267.      */
  268.     public function getId()
  269.     {
  270.         return $this->id;
  271.     }
  272.     /**
  273.      * Set tempId
  274.      *
  275.      * @param integer $tempId
  276.      *
  277.      * @return Vehicle
  278.      */
  279.     public function setTempId($tempId)
  280.     {
  281.         $this->temp_id $tempId;
  282.         return $this;
  283.     }
  284.     /**
  285.      * Get tempId
  286.      *
  287.      * @return integer
  288.      */
  289.     public function getTempId()
  290.     {
  291.         return $this->temp_id;
  292.     }
  293.     /**
  294.      * Set dateCreate
  295.      *
  296.      * @param DateTime $dateCreate
  297.      *
  298.      * @return Vehicle
  299.      */
  300.     public function setDateCreate($dateCreate)
  301.     {
  302.         $this->date_create $dateCreate;
  303.         return $this;
  304.     }
  305.     /**
  306.      * Get dateCreate
  307.      *
  308.      * @return DateTime
  309.      */
  310.     public function getDateCreate()
  311.     {
  312.         return $this->date_create;
  313.     }
  314.     /**
  315.      * Set vehicleType
  316.      *
  317.      * @param integer $vehicleType
  318.      *
  319.      * @return Vehicle
  320.      */
  321.     public function setVehicleType($vehicleType)
  322.     {
  323.         $this->vehicle_type $vehicleType;
  324.         return $this;
  325.     }
  326.     /**
  327.      * Get vehicleType
  328.      *
  329.      * @return integer
  330.      */
  331.     public function getVehicleType()
  332.     {
  333.         return $this->vehicle_type;
  334.     }
  335.     /**
  336.      * Set url
  337.      *
  338.      * @param string $url
  339.      *
  340.      * @return Vehicle
  341.      */
  342.     public function setUrl($url)
  343.     {
  344.         $this->url $url;
  345.         return $this;
  346.     }
  347.     /**
  348.      * Get url
  349.      *
  350.      * @return string
  351.      */
  352.     public function getUrl()
  353.     {
  354.         return $this->url;
  355.     }
  356.     /**
  357.      * Set vin
  358.      *
  359.      * @param string $vin
  360.      *
  361.      * @return Vehicle
  362.      */
  363.     public function setVin($vin)
  364.     {
  365.         $this->vin $vin;
  366.         return $this;
  367.     }
  368.     /**
  369.      * Get vin
  370.      *
  371.      * @return string
  372.      */
  373.     public function getVin()
  374.     {
  375.         return $this->vin;
  376.     }
  377.     /**
  378.      * Set state
  379.      *
  380.      * @param integer $state
  381.      *
  382.      * @return Vehicle
  383.      */
  384.     public function setState($state)
  385.     {
  386.         $this->state $state;
  387.         return $this;
  388.     }
  389.     /**
  390.      * Get state
  391.      *
  392.      * @return integer
  393.      */
  394.     public function getState()
  395.     {
  396.         return $this->state 0;
  397.     }
  398.     /**
  399.      * Set showDisabled
  400.      *
  401.      * @param integer $showDisabled
  402.      *
  403.      * @return Vehicle
  404.      */
  405.     public function setShowDisabled($showDisabled)
  406.     {
  407.         $this->show_disabled $showDisabled;
  408.         return $this;
  409.     }
  410.     /**
  411.      * Get showDisabled
  412.      *
  413.      * @return integer
  414.      */
  415.     public function getShowDisabled()
  416.     {
  417.         return $this->show_disabled 0;
  418.     }
  419.     /**
  420.      * Set position
  421.      *
  422.      * @param integer $position
  423.      *
  424.      * @return Vehicle
  425.      */
  426.     public function setPosition($position)
  427.     {
  428.         $this->position $position;
  429.         return $this;
  430.     }
  431.     /**
  432.      * Get position
  433.      *
  434.      * @return integer
  435.      */
  436.     public function getPosition()
  437.     {
  438.         return $this->position;
  439.     }
  440.     /**
  441.      * Set testDrive
  442.      *
  443.      * @param string $testDrive
  444.      *
  445.      * @return Vehicle
  446.      */
  447.     public function setTestDrive($testDrive)
  448.     {
  449.         $this->test_drive $testDrive;
  450.         return $this;
  451.     }
  452.     /**
  453.      * Get testDrive
  454.      *
  455.      * @return string
  456.      */
  457.     public function getTestDrive()
  458.     {
  459.         return $this->test_drive 0;
  460.     }
  461.     /**
  462.      * Set creditAvailable
  463.      *
  464.      * @param integer $creditAvailable
  465.      *
  466.      * @return Vehicle
  467.      */
  468.     public function setCreditAvailable($creditAvailable)
  469.     {
  470.         $this->credit_available $creditAvailable;
  471.         return $this;
  472.     }
  473.     /**
  474.      * Get creditAvailable
  475.      *
  476.      * @return integer
  477.      */
  478.     public function getCreditAvailable()
  479.     {
  480.         return $this->credit_available 0;
  481.     }
  482.     /**
  483.      * Set recommend
  484.      *
  485.      * @param integer $recommend
  486.      *
  487.      * @return Vehicle
  488.      */
  489.     public function setRecommend($recommend)
  490.     {
  491.         $this->recommend $recommend;
  492.         return $this;
  493.     }
  494.     /**
  495.      * Get recommend
  496.      *
  497.      * @return integer
  498.      */
  499.     public function getRecommend()
  500.     {
  501.         return $this->recommend 0;
  502.     }
  503.     /**
  504.      * Set isNewModel
  505.      *
  506.      * @param integer $isNewModel
  507.      *
  508.      * @return Vehicle
  509.      */
  510.     public function setIsNewModel($isNewModel)
  511.     {
  512.         $this->is_new_model $isNewModel;
  513.         return $this;
  514.     }
  515.     /**
  516.      * Get isNewModel
  517.      *
  518.      * @return integer
  519.      */
  520.     public function getIsNewModel()
  521.     {
  522.         return $this->is_new_model 0;
  523.     }
  524.     /**
  525.      * Set isUsed
  526.      *
  527.      * @param integer $isUsed
  528.      *
  529.      * @return Vehicle
  530.      */
  531.     public function setIsUsed($isUsed)
  532.     {
  533.         $this->is_used $isUsed;
  534.         return $this;
  535.     }
  536.     /**
  537.      * Get isUsed
  538.      *
  539.      * @return integer
  540.      */
  541.     public function getIsUsed()
  542.     {
  543.         return $this->is_used 0;
  544.     }
  545.     /**
  546.      * Set hasNds
  547.      *
  548.      * @param integer $hasNds
  549.      *
  550.      * @return Vehicle
  551.      */
  552.     public function setHasNds($hasNds)
  553.     {
  554.         $this->has_nds $hasNds;
  555.         return $this;
  556.     }
  557.     /**
  558.      * Get hasNds
  559.      *
  560.      * @return integer
  561.      */
  562.     public function getHasNds()
  563.     {
  564.         return $this->has_nds 0;
  565.     }
  566.     /**
  567.      * Set image
  568.      *
  569.      * @param Media $image
  570.      *
  571.      * @return Vehicle
  572.      */
  573.     public function setImage(Media $image null)
  574.     {
  575.         $this->image $image;
  576.         return $this;
  577.     }
  578.     /**
  579.      * Get image
  580.      *
  581.      * @return Media
  582.      */
  583.     public function getImage()
  584.     {
  585.         return $this->image;
  586.     }
  587.     /**
  588.      * Set preview
  589.      *
  590.      * @param Media $preview
  591.      *
  592.      * @return Vehicle
  593.      */
  594.     public function setPreview(Media $preview null)
  595.     {
  596.         $this->preview $preview;
  597.         return $this;
  598.     }
  599.     /**
  600.      * Get preview
  601.      *
  602.      * @return Media
  603.      */
  604.     public function getPreview()
  605.     {
  606.         return $this->preview;
  607.     }
  608.     /**
  609.      * Set previewSecond
  610.      *
  611.      * @param Media $previewSecond
  612.      *
  613.      * @return Vehicle
  614.      */
  615.     public function setPreviewSecond(Media $previewSecond null)
  616.     {
  617.         $this->preview_second $previewSecond;
  618.         return $this;
  619.     }
  620.     /**
  621.      * Get previewSecond
  622.      *
  623.      * @return Media
  624.      */
  625.     public function getPreviewSecond()
  626.     {
  627.         return $this->preview_second;
  628.     }
  629.     /**
  630.      * Set gallery
  631.      *
  632.      * @param Gallery $gallery
  633.      *
  634.      * @return Vehicle
  635.      */
  636.     public function setGallery(Gallery $gallery null)
  637.     {
  638.         $this->gallery $gallery;
  639.         return $this;
  640.     }
  641.     /**
  642.      * Get gallery
  643.      *
  644.      * @return Gallery
  645.      */
  646.     public function getGallery()
  647.     {
  648.         return $this->gallery;
  649.     }
  650.     /**
  651.      * Set video
  652.      *
  653.      * @param Gallery $video
  654.      *
  655.      * @return Vehicle
  656.      */
  657.     public function setVideo(Gallery $video null)
  658.     {
  659.         $this->video $video;
  660.         return $this;
  661.     }
  662.     /**
  663.      * Get video
  664.      *
  665.      * @return Gallery
  666.      */
  667.     public function getVideo()
  668.     {
  669.         return $this->video;
  670.     }
  671.     /**
  672.      * Add file
  673.      *
  674.      * @param VehicleFile $file
  675.      *
  676.      * @return Vehicle
  677.      */
  678.     public function addFile(VehicleFile $file)
  679.     {
  680.         $this->files[] = $file;
  681.         return $this;
  682.     }
  683.     /**
  684.      * Remove file
  685.      *
  686.      * @param VehicleFile $file
  687.      */
  688.     public function removeFile(VehicleFile $file)
  689.     {
  690.         $this->files->removeElement($file);
  691.     }
  692.     /**
  693.      * Get files
  694.      *
  695.      * @return Collection
  696.      */
  697.     public function getFiles()
  698.     {
  699.         return $this->files;
  700.     }
  701.     /**
  702.      * Add content
  703.      *
  704.      * @param VehicleContent $content
  705.      *
  706.      * @return Vehicle
  707.      */
  708.     public function addContent(VehicleContent $content)
  709.     {
  710.         $this->content[] = $content;
  711.         return $this;
  712.     }
  713.     /**
  714.      * Remove content
  715.      *
  716.      * @param VehicleContent $content
  717.      */
  718.     public function removeContent(VehicleContent $content)
  719.     {
  720.         $this->content->removeElement($content);
  721.     }
  722.     /**
  723.      * Get content
  724.      *
  725.      * @return Collection
  726.      */
  727.     public function getContent()
  728.     {
  729.         return $this->content;
  730.     }
  731.     /**
  732.      * @param $locale
  733.      * @return VehicleContent
  734.      */
  735.     public function getContentByLocale($locale)
  736.     {
  737.         foreach ($this->getContent() as $content) {
  738.             if($content->getLanguage() == $locale) {
  739.                 return $content;
  740.             }
  741.         }
  742.         return $this->getContent()->first();
  743.     }
  744.     /**
  745.      * Add equipment
  746.      *
  747.      * @param Equipment $equipment
  748.      *
  749.      * @return Vehicle
  750.      */
  751.     public function addEquipment(Equipment $equipment)
  752.     {
  753.         $this->equipments[] = $equipment;
  754.         return $this;
  755.     }
  756.     /**
  757.      * Remove equipment
  758.      *
  759.      * @param Equipment $equipment
  760.      */
  761.     public function removeEquipment(Equipment $equipment)
  762.     {
  763.         $this->equipments->removeElement($equipment);
  764.     }
  765.     /**
  766.      * Get equipments
  767.      *
  768.      * @return Collection
  769.      */
  770.     public function getEquipments()
  771.     {
  772.         return $this->equipments;
  773.     }
  774.     public function getArrayEquipments()
  775.     {
  776.         return $this->equipments->toArray();
  777.     }
  778.     /**
  779.      * Add feature
  780.      *
  781.      * @param Feature $feature
  782.      *
  783.      * @return Vehicle
  784.      */
  785.     public function addFeature(Feature $feature)
  786.     {
  787.         $this->features[] = $feature;
  788.         return $this;
  789.     }
  790.     /**
  791.      * Remove feature
  792.      *
  793.      * @param Feature $feature
  794.      */
  795.     public function removeFeature(Feature $feature)
  796.     {
  797.         $this->features->removeElement($feature);
  798.     }
  799.     /**
  800.      * Get features
  801.      *
  802.      * @return Collection
  803.      */
  804.     public function getFeatures()
  805.     {
  806.         return $this->features;
  807.     }
  808.     /**
  809.      * Add variation
  810.      *
  811.      * @param Variation $variation
  812.      *
  813.      * @return Vehicle
  814.      */
  815.     public function addVariation(Variation $variation)
  816.     {
  817.         $this->variations[] = $variation;
  818.         return $this;
  819.     }
  820.     /**
  821.      * Remove variation
  822.      *
  823.      * @param Variation $variation
  824.      */
  825.     public function removeVariation(Variation $variation)
  826.     {
  827.         $this->variations->removeElement($variation);
  828.     }
  829.     /**
  830.      * Get variations
  831.      *
  832.      * @return Collection
  833.      */
  834.     public function getVariations()
  835.     {
  836.         return $this->variations;
  837.     }
  838.     public function getArrayVariations()
  839.     {
  840.         return $this->variations->toArray();
  841.     }
  842.     /**
  843.      * Set creator
  844.      *
  845.      * @param User $creator
  846.      *
  847.      * @return Vehicle
  848.      */
  849.     public function setCreator(User $creator null)
  850.     {
  851.         $this->creator $creator;
  852.         return $this;
  853.     }
  854.     /**
  855.      * Get creator
  856.      *
  857.      * @return User
  858.      */
  859.     public function getCreator()
  860.     {
  861.         return $this->creator;
  862.     }
  863.     /**
  864.      * Set dealer
  865.      *
  866.      * @param Dealer $dealer
  867.      *
  868.      * @return Vehicle
  869.      */
  870.     public function setDealer(Dealer $dealer null)
  871.     {
  872.         $this->dealer $dealer;
  873.         return $this;
  874.     }
  875.     /**
  876.      * Get dealer
  877.      *
  878.      * @return Dealer
  879.      */
  880.     public function getDealer()
  881.     {
  882.         return $this->dealer;
  883.     }
  884.     /**
  885.      * Set model
  886.      *
  887.      * @param Model $model
  888.      *
  889.      * @return Vehicle
  890.      */
  891.     public function setModel(Model $model null)
  892.     {
  893.         $this->model $model;
  894.         return $this;
  895.     }
  896.     /**
  897.      * Get model
  898.      *
  899.      * @return Model
  900.      */
  901.     public function getModel()
  902.     {
  903.         return $this->model;
  904.     }
  905.     /**
  906.      * Set category
  907.      *
  908.      * @param Category $category
  909.      *
  910.      * @return Vehicle
  911.      */
  912.     public function setCategory(Category $category null)
  913.     {
  914.         $this->category $category;
  915.         return $this;
  916.     }
  917.     /**
  918.      * Get category
  919.      *
  920.      * @return Category
  921.      */
  922.     public function getCategory()
  923.     {
  924.         return $this->category;
  925.     }
  926.     /**
  927.      * Set group
  928.      *
  929.      * @param Group $group
  930.      *
  931.      * @return Vehicle
  932.      */
  933.     public function setGroup(Group $group null)
  934.     {
  935.         $this->group $group;
  936.         return $this;
  937.     }
  938.     /**
  939.      * Get group
  940.      *
  941.      * @return Group
  942.      */
  943.     public function getGroup()
  944.     {
  945.         return $this->group;
  946.     }
  947.     /**
  948.      * Add post
  949.      *
  950.      * @param Post $post
  951.      *
  952.      * @return Vehicle
  953.      */
  954.     public function addPost(Post $post)
  955.     {
  956.         $this->posts[] = $post;
  957.         return $this;
  958.     }
  959.     /**
  960.      * Remove post
  961.      *
  962.      * @param Post $post
  963.      */
  964.     public function removePost(Post $post)
  965.     {
  966.         $this->posts->removeElement($post);
  967.     }
  968.     /**
  969.      * Get posts
  970.      *
  971.      * @return Collection
  972.      */
  973.     public function getPosts()
  974.     {
  975.         return $this->posts;
  976.     }
  977.     /**
  978.      * Set adminName
  979.      *
  980.      * @param string $adminName
  981.      *
  982.      * @return Vehicle
  983.      */
  984.     public function setAdminName($adminName)
  985.     {
  986.         $this->admin_name $adminName;
  987.         return $this;
  988.     }
  989.     /**
  990.      * Get adminName
  991.      *
  992.      * @return string
  993.      */
  994.     public function getAdminName()
  995.     {
  996.         if($this->admin_name) {
  997.             return  $this->admin_name;
  998.         }
  999.         if(!$this->getModel()) {
  1000.             return  '';
  1001.         }
  1002.         return $this->getModel()->getTitle();
  1003.     }
  1004.     public function __toString()
  1005.     {
  1006.         $name $this->getAdminName();
  1007.         if(!$this->getState()) {
  1008.             $name .= ' (не Ð°ÐºÑ‚ивна)';
  1009.         }
  1010.         return $name;
  1011.     }
  1012.     /**
  1013.      * Add color
  1014.      *
  1015.      * @param ConfiguratorColor $color
  1016.      *
  1017.      * @return Vehicle
  1018.      */
  1019.     public function addColor(ConfiguratorColor $color)
  1020.     {
  1021.         $this->colors[] = $color;
  1022.         return $this;
  1023.     }
  1024.     /**
  1025.      * Remove color
  1026.      *
  1027.      * @param ConfiguratorColor $color
  1028.      */
  1029.     public function removeColor(ConfiguratorColor $color)
  1030.     {
  1031.         $this->colors->removeElement($color);
  1032.     }
  1033.     /**
  1034.      * Get colors
  1035.      *
  1036.      * @return Collection
  1037.      */
  1038.     public function getColors()
  1039.     {
  1040.         return $this->colors;
  1041.     }
  1042.     /**
  1043.      * Add interier
  1044.      *
  1045.      * @param ConfiguratorInterier $interier
  1046.      *
  1047.      * @return Vehicle
  1048.      */
  1049.     public function addInterier(ConfiguratorInterier $interier)
  1050.     {
  1051.         $this->interiers[] = $interier;
  1052.         return $this;
  1053.     }
  1054.     /**
  1055.      * Remove interier
  1056.      *
  1057.      * @param ConfiguratorInterier $interier
  1058.      */
  1059.     public function removeInterier(ConfiguratorInterier $interier)
  1060.     {
  1061.         $this->interiers->removeElement($interier);
  1062.     }
  1063.     /**
  1064.      * Get interiers
  1065.      *
  1066.      * @return Collection
  1067.      */
  1068.     public function getInteriers()
  1069.     {
  1070.         return $this->interiers;
  1071.     }
  1072.     /**
  1073.      * Add vehicleItem
  1074.      *
  1075.      * @param VehicleItem $vehicleItem
  1076.      *
  1077.      * @return Vehicle
  1078.      */
  1079.     public function addVehicleItem(VehicleItem $vehicleItem)
  1080.     {
  1081.         $this->vehicle_items[] = $vehicleItem;
  1082.         return $this;
  1083.     }
  1084.     /**
  1085.      * Remove vehicleItem
  1086.      *
  1087.      * @param VehicleItem $vehicleItem
  1088.      */
  1089.     public function removeVehicleItem(VehicleItem $vehicleItem)
  1090.     {
  1091.         $this->vehicle_items->removeElement($vehicleItem);
  1092.     }
  1093.     /**
  1094.      * Get vehicleItems
  1095.      *
  1096.      * @return Collection
  1097.      */
  1098.     public function getVehicleItems()
  1099.     {
  1100.         return $this->vehicle_items;
  1101.     }
  1102.     public function getArrayVehicleItems()
  1103.     {
  1104.         return $this->vehicle_items->toArray();
  1105.     }
  1106.     /**
  1107.      * @var string
  1108.      */
  1109.     private $is_delete 0;
  1110.     /**
  1111.      * Set isDelete
  1112.      *
  1113.      * @param string $isDelete
  1114.      *
  1115.      * @return Vehicle
  1116.      */
  1117.     public function setIsDelete($isDelete)
  1118.     {
  1119.         $this->is_delete $isDelete;
  1120.         return $this;
  1121.     }
  1122.     /**
  1123.      * Get isDelete
  1124.      *
  1125.      * @return string
  1126.      */
  1127.     public function getIsDelete()
  1128.     {
  1129.         return $this->is_delete;
  1130.     }
  1131.     /**
  1132.      * @var string
  1133.      */
  1134.     private $card_js;
  1135.     /**
  1136.      * Set cardJs
  1137.      *
  1138.      * @param string $cardJs
  1139.      *
  1140.      * @return Vehicle
  1141.      */
  1142.     public function setCardJs($cardJs)
  1143.     {
  1144.         $this->card_js $cardJs;
  1145.         return $this;
  1146.     }
  1147.     /**
  1148.      * Get cardJs
  1149.      *
  1150.      * @return string
  1151.      */
  1152.     public function getCardJs()
  1153.     {
  1154.         return $this->card_js;
  1155.     }
  1156.     private $school_available 0;
  1157.     /**
  1158.      * Set schoolAvailable
  1159.      *
  1160.      * @param integer $schoolAvailable
  1161.      *
  1162.      * @return Vehicle
  1163.      */
  1164.     public function setSchoolAvailable($schoolAvailable)
  1165.     {
  1166.         $this->school_available $schoolAvailable;
  1167.         return $this;
  1168.     }
  1169.     /**
  1170.      * Get schoolAvailable
  1171.      *
  1172.      * @return integer
  1173.      */
  1174.     public function getSchoolAvailable()
  1175.     {
  1176.         return $this->school_available 0;
  1177.     }
  1178.     /**
  1179.      * @var string
  1180.      */
  1181.     private $ria_id;
  1182.     /**
  1183.      * Set riaId
  1184.      *
  1185.      * @param string $riaId
  1186.      *
  1187.      * @return Vehicle
  1188.      */
  1189.     public function setRiaId($riaId)
  1190.     {
  1191.         $this->ria_id $riaId;
  1192.         return $this;
  1193.     }
  1194.     /**
  1195.      * Get riaId
  1196.      *
  1197.      * @return string
  1198.      */
  1199.     public function getRiaId()
  1200.     {
  1201.         return $this->ria_id;
  1202.     }
  1203.     /**
  1204.      * @var Collection
  1205.      */
  1206.     private $recommend_group;
  1207.     /**
  1208.      * Add recommendGroup
  1209.      *
  1210.      * @param RecommendGroup $recommendGroup
  1211.      *
  1212.      * @return Vehicle
  1213.      */
  1214.     public function addRecommendGroup(RecommendGroup $recommendGroup)
  1215.     {
  1216.         $this->recommend_group[] = $recommendGroup;
  1217.         return $this;
  1218.     }
  1219.     /**
  1220.      * Remove recommendGroup
  1221.      *
  1222.      * @param RecommendGroup $recommendGroup
  1223.      */
  1224.     public function removeRecommendGroup(RecommendGroup $recommendGroup)
  1225.     {
  1226.         $this->recommend_group->removeElement($recommendGroup);
  1227.     }
  1228.     /**
  1229.      * Get recommendGroup
  1230.      *
  1231.      * @return Collection
  1232.      */
  1233.     public function getRecommendGroup()
  1234.     {
  1235.         return $this->recommend_group;
  1236.     }
  1237.     /**
  1238.      * @var string
  1239.      */
  1240.     private $ria_options;
  1241.     /**
  1242.      * Set riaOptions
  1243.      *
  1244.      * @param string $riaOptions
  1245.      *
  1246.      * @return Vehicle
  1247.      */
  1248.     public function setRiaOptions($riaOptions)
  1249.     {
  1250.         $this->ria_options $riaOptions;
  1251.         return $this;
  1252.     }
  1253.     /**
  1254.      * Get riaOptions
  1255.      *
  1256.      * @return string
  1257.      */
  1258.     public function getRiaOptions()
  1259.     {
  1260.         return $this->ria_options;
  1261.     }
  1262.     /**
  1263.      * Set crmId
  1264.      *
  1265.      * @param string $crmId
  1266.      *
  1267.      * @return Vehicle
  1268.      */
  1269.     public function setCrmId($crmId)
  1270.     {
  1271.         $this->crm_id $crmId;
  1272.         return $this;
  1273.     }
  1274.     /**
  1275.      * Get crmId
  1276.      *
  1277.      * @return string
  1278.      */
  1279.     public function getCrmId()
  1280.     {
  1281.         return $this->crm_id;
  1282.     }
  1283.     /**
  1284.      * @return int
  1285.      */
  1286.     public function getIsNotFilled()
  1287.     {
  1288.         return $this->is_not_filled;
  1289.     }
  1290.     /**
  1291.      * @param int $is_not_filled
  1292.      *
  1293.      * @return Vehicle
  1294.      */
  1295.     public function setIsNotFilled($is_not_filled)
  1296.     {
  1297.         $this->is_not_filled $is_not_filled;
  1298.         return $this;
  1299.     }
  1300.     /**
  1301.      * @return int
  1302.      */
  1303.     public function getRiaLevel()
  1304.     {
  1305.         return $this->ria_level;
  1306.     }
  1307.     /**
  1308.      * @param int $ria_level
  1309.      *
  1310.      * @return Vehicle
  1311.      */
  1312.     public function setRiaLevel($ria_level)
  1313.     {
  1314.         $this->ria_level $ria_level;
  1315.         return $this;
  1316.     }
  1317.     /**
  1318.      * @return int
  1319.      */
  1320.     public function getRiaPeriod()
  1321.     {
  1322.         return $this->ria_period;
  1323.     }
  1324.     /**
  1325.      * @param int $ria_period
  1326.      *
  1327.      * @return Vehicle
  1328.      */
  1329.     public function setRiaPeriod($ria_period)
  1330.     {
  1331.         $this->ria_period $ria_period;
  1332.         return $this;
  1333.     }
  1334.     /**
  1335.      * @var integer
  1336.      */
  1337.     private $views;
  1338.     /**
  1339.      * Set views
  1340.      *
  1341.      * @param integer $views
  1342.      *
  1343.      * @return Vehicle
  1344.      */
  1345.     public function setViews($views)
  1346.     {
  1347.         $this->views $views;
  1348.         return $this;
  1349.     }
  1350.     /**
  1351.      * Get views
  1352.      *
  1353.      * @return integer
  1354.      */
  1355.     public function getViews()
  1356.     {
  1357.         return $this->views;
  1358.     }
  1359.     /**
  1360.      * @return DateTime
  1361.      */
  1362.     public function getRiaPublicationDate()
  1363.     {
  1364.         return $this->ria_publication_date;
  1365.     }
  1366.     /**
  1367.      * @param DateTime $ria_publication_date
  1368.      *
  1369.      * @return Vehicle
  1370.      */
  1371.     public function setRiaPublicationDate($ria_publication_date)
  1372.     {
  1373.         $this->ria_publication_date $ria_publication_date;
  1374.         return $this;
  1375.     }
  1376.     /**
  1377.      * @return DateTime
  1378.      */
  1379.     public function getRiaTopPublicationDate()
  1380.     {
  1381.         return $this->ria_top_publication_date;
  1382.     }
  1383.     /**
  1384.      * @param DateTime $ria_top_publication_date
  1385.      *
  1386.      * @return Vehicle
  1387.      */
  1388.     public function setRiaTopPublicationDate($ria_top_publication_date)
  1389.     {
  1390.         $this->ria_top_publication_date $ria_top_publication_date;
  1391.         return $this;
  1392.     }
  1393.     /**
  1394.      * @return int
  1395.      */
  1396.     public function getRiaIsNotified()
  1397.     {
  1398.         return $this->ria_is_notified;
  1399.     }
  1400.     /**
  1401.      * @param int $ria_is_notified
  1402.      *
  1403.      * @return Vehicle
  1404.      */
  1405.     public function setRiaIsNotified($ria_is_notified)
  1406.     {
  1407.         $this->ria_is_notified $ria_is_notified;
  1408.         return $this;
  1409.     }
  1410.     public function getDays()
  1411.     {
  1412.         $days 1;
  1413.         if ($this->date_create) {
  1414.             $days = (new DateTime('now'))->diff($this->date_create)->days;
  1415.             $days $days $days;
  1416.         }
  1417.         return $days;
  1418.     }
  1419.     public function getAdminViews()
  1420.     {
  1421.         $perDays ceil($this->views $this->getDays()) ;
  1422.         return ((int) $this->views).' / '.$perDays;
  1423.     }
  1424.     /**
  1425.      * @var Collection
  1426.      */
  1427.     private $faqs;
  1428.     /**
  1429.      * Add faq
  1430.      *
  1431.      * @param Faq $faq
  1432.      *
  1433.      * @return Vehicle
  1434.      */
  1435.     public function addFaq(Faq $faq)
  1436.     {
  1437.         $this->faqs[] = $faq;
  1438.         return $this;
  1439.     }
  1440.     /**
  1441.      * Remove faq
  1442.      *
  1443.      * @param Faq $faq
  1444.      */
  1445.     public function removeFaq(Faq $faq)
  1446.     {
  1447.         $this->faqs->removeElement($faq);
  1448.     }
  1449.     /**
  1450.      * Get faq
  1451.      *
  1452.      * @return Collection
  1453.      */
  1454.     public function getFaqs()
  1455.     {
  1456.         return $this->faqs;
  1457.     }
  1458.     /**
  1459.      * Set isPreOrder
  1460.      *
  1461.      * @param integer $isPreOrder
  1462.      *
  1463.      * @return Vehicle
  1464.      */
  1465.     public function setIsPreOrder($isPreOrder)
  1466.     {
  1467.         $this->is_pre_order $isPreOrder;
  1468.         return $this;
  1469.     }
  1470.     /**
  1471.      * Get isPreOrder
  1472.      *
  1473.      * @return integer
  1474.      */
  1475.     public function getIsPreOrder()
  1476.     {
  1477.         return $this->is_pre_order 0;
  1478.     }
  1479.     /**
  1480.      * Add boatEngine
  1481.      *
  1482.      * @param \CoreBundle\Entity\Vehicles\Vehicle $boatEngine
  1483.      *
  1484.      * @return Vehicle
  1485.      */
  1486.     public function addBoatEngine(\CoreBundle\Entity\Vehicles\Vehicle $boatEngine)
  1487.     {
  1488.         $this->boat_engine[] = $boatEngine;
  1489.         return $this;
  1490.     }
  1491.     /**
  1492.      * Remove boatEngine
  1493.      *
  1494.      * @param \CoreBundle\Entity\Vehicles\Vehicle $boatEngine
  1495.      */
  1496.     public function removeBoatEngine(\CoreBundle\Entity\Vehicles\Vehicle $boatEngine)
  1497.     {
  1498.         $this->boat_engine->removeElement($boatEngine);
  1499.     }
  1500.     /**
  1501.      * Get boatEngine
  1502.      *
  1503.      * @return Collection
  1504.      */
  1505.     public function getBoatEngine()
  1506.     {
  1507.         return $this->boat_engine;
  1508.     }
  1509.     /**
  1510.      * @var boolean
  1511.      */
  1512.     private $noindex_follow false;
  1513.     /**
  1514.      * Set noindexFollow
  1515.      *
  1516.      * @param boolean $noindexFollow
  1517.      *
  1518.      * @return Vehicle
  1519.      */
  1520.     public function setNoindexFollow($noindexFollow)
  1521.     {
  1522.         $this->noindex_follow $noindexFollow;
  1523.         return $this;
  1524.     }
  1525.     /**
  1526.      * Get noindexFollow
  1527.      *
  1528.      * @return boolean
  1529.      */
  1530.     public function getNoindexFollow()
  1531.     {
  1532.         return $this->noindex_follow;
  1533.     }
  1534.     /**
  1535.      * @var Collection
  1536.      */
  1537.     private $categories;
  1538.     /**
  1539.      * Add category.
  1540.      *
  1541.      * @param Category $category
  1542.      *
  1543.      * @return Vehicle
  1544.      */
  1545.     public function addCategory(Category $category)
  1546.     {
  1547.         $this->categories[] = $category;
  1548.         return $this;
  1549.     }
  1550.     /**
  1551.      * Remove category.
  1552.      *
  1553.      * @param Category $category
  1554.      *
  1555.      * @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
  1556.      */
  1557.     public function removeCategory(Category $category)
  1558.     {
  1559.         return $this->categories->removeElement($category);
  1560.     }
  1561.     /**
  1562.      * Get categories.
  1563.      *
  1564.      * @return Collection
  1565.      */
  1566.     public function getCategories()
  1567.     {
  1568.         return $this->categories;
  1569.     }
  1570.     /**
  1571.      * Add autoRiaOption.
  1572.      *
  1573.      * @param AutoRiaOptions $autoRiaOption
  1574.      * @param bool $isShow
  1575.      * @return Vehicle
  1576.      */
  1577.     public function addAutoRiaOption(AutoRiaOptions $autoRiaOptionbool $isShow true): self
  1578.     {
  1579.         foreach ($this->vehicle_auto_ria_options as $relation) {
  1580.             if ($relation->getOption() === $autoRiaOption) {
  1581.                 $relation->setIsShowInPdf($isShow);
  1582.                 return $this;
  1583.             }
  1584.         }
  1585.         $relation = new VehicleAutoRiaOption();
  1586.         $relation->setVehicle($this);
  1587.         $relation->setOption($autoRiaOption);
  1588.         $relation->setIsShowInPdf($isShow);
  1589.         $this->vehicle_auto_ria_options[] = $relation;
  1590.         return $this;
  1591.     }
  1592.     /**
  1593.      * Remove autoRiaOption.
  1594.      *
  1595.      * @param AutoRiaOptions $autoRiaOption
  1596.      *
  1597.      * @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
  1598.      */
  1599.     public function removeAutoRiaOption(AutoRiaOptions $autoRiaOption): bool
  1600.     {
  1601.         foreach ($this->vehicle_auto_ria_options as $key => $relation) {
  1602.             if ($relation->getOption() === $autoRiaOption) {
  1603.                 $this->vehicle_auto_ria_options->remove($key);
  1604.                 return true;
  1605.             }
  1606.         }
  1607.         return false;
  1608.     }
  1609.     /**
  1610.      * Get autoRiaOption.
  1611.      *
  1612.      * @return Collection
  1613.      */
  1614.     public function getAutoRiaOptions(): Collection
  1615.     {
  1616.         if (is_null($this->vehicle_auto_ria_options)) {
  1617.             return new ArrayCollection();
  1618.         }
  1619.         return $this->vehicle_auto_ria_options->map(function(VehicleAutoRiaOption $relation) {
  1620.             return $relation->getOption();
  1621.         });
  1622.     }
  1623.     /**
  1624.      * @return Collection|VehicleAutoRiaOption[]
  1625.      */
  1626.     public function getVehicleAutoRiaOptions(): ?Collection
  1627.     {
  1628.         if (is_null($this->vehicle_auto_ria_options)){
  1629.             return new ArrayCollection();
  1630.         }
  1631.         return $this->vehicle_auto_ria_options;
  1632.     }
  1633.     public function addVehicleAutoRiaOption(VehicleAutoRiaOption $option)
  1634.     {
  1635.         if (!$this->vehicle_auto_ria_options->contains($option)) {
  1636.             $option->setVehicle($this);
  1637.             $this->vehicle_auto_ria_options[] = $option;
  1638.         }
  1639.     }
  1640.     public function removeVehicleAutoRiaOption(VehicleAutoRiaOption $option)
  1641.     {
  1642.         if ($this->vehicle_auto_ria_options->contains($option)) {
  1643.             $this->vehicle_auto_ria_options->removeElement($option);
  1644.             $option->setVehicle(null);
  1645.         }
  1646.     }
  1647.     public function setVehicleCardType(?VehicleCardType $vehicleCardType): Vehicle
  1648.     {
  1649.         $this->vehicleCardType $vehicleCardType;
  1650.         if ($vehicleCardType !== null) {
  1651.             $vehicleCardType->setVehicle($this);
  1652.         }
  1653.         return $this;
  1654.     }
  1655.     public function getVehicleCardType(): ?VehicleCardType
  1656.     {
  1657.         return $this->vehicleCardType;
  1658.     }
  1659.     public function getUpdatedAt(): DateTime
  1660.     {
  1661.         return $this->updatedAt;
  1662.     }
  1663.     public function setUpdatedAt(): self
  1664.     {
  1665.         $this->updatedAt = new \DateTime();
  1666.         return $this;
  1667.     }
  1668. }