src/Entity/Otpusk/Hotel.php line 37

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Otpusk;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\EntityNotFoundException;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\Validator\Context\ExecutionContextInterface;
  8. use Symfony\Component\Validator\Constraints as Assert;
  9. use App\Entity\Otpusk\Geo\BaseObject;
  10. /**
  11.  * @ORM\Entity(repositoryClass="App\Repository\Otpusk\HotelRepository")
  12.  *
  13.  * @ORM\Table(
  14.  *     name="tHotels",
  15.  *     options={
  16.  *          "charset":"utf8",
  17.  *          "engine": "InnoDB",
  18.  *          "comment":"Отели"
  19.  *      },
  20.  *     uniqueConstraints={@ORM\UniqueConstraint(name="unique", columns={"fCityID", "fTranslit"})},
  21.  *     indexes={
  22.  *          @ORM\Index(name="fLastMsgType", columns={"fLastMsgType"}),
  23.  *          @ORM\Index(name="fName", columns={"fName"}),
  24.  *          @ORM\Index(name="fTopRate", columns={"fTopRate"}),
  25.  *          @ORM\Index(name="fLastMsgDate", columns={"fLastMsgDate"}),
  26.  *          @ORM\Index(name="fStars", columns={"fStars"}),
  27.  *          @ORM\Index(name="fk_tHotels_1_idx", columns={"chainId"}),
  28.  *          @ORM\Index(name="fRefsConfirm", columns={"fRefsConfirm"})
  29.  *     }),
  30.  * )
  31.  */
  32. class Hotel extends BaseObject
  33. {
  34.     public static $hotelStars = ['one'=>'1*','two'=>'2*','three'=>'3*','four'=>'4*','five'=>'5*','hv1'=>'HV1','hv2'=>'HV2'];
  35.     //@ORM\Column(name="lastUpdate", type="datetime", columnDefinition="DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL COMMENT 'дата последнего обновления информации'", options={"comment":"дата последнего обновления информации"} )
  36.     /**
  37.      * @var
  38.      * @ORM\Column(name="lastUpdate", type="datetime", options={"default":"CURRENT_TIMESTAMP", "comment":"дата последнего обновления информации"}, nullable=false)
  39.      */
  40.     private $lastUpdate;
  41.     /**
  42.      * @var integer
  43.      * @ORM\Column(name="fCityID", type="integer", length=6, nullable=true, options={"unsigned":true, "default":NULL})
  44.      */
  45.     private $cityId;
  46.     /**
  47.      * @var string
  48.      * @ORM\Column(name="fName", type="string", length=100, options={"fixed":true})
  49.      */
  50.     private $name;
  51.     /**
  52.      * @var string
  53.      * @ORM\Column(name="fNameUkr", type="string", length=100)
  54.      */
  55.     private $nameUkr;
  56.     /**
  57.      * @var string
  58.      * @ORM\Column(name="fTranslit", type="string", length=100, options={"fixed":true})
  59.      */
  60.     private $translit;
  61.     /**
  62.      * @var string
  63.      * @ORM\Column(name="fTranslitRu", type="string", length=500)
  64.      */
  65.     private $translitRu;
  66.     /**
  67.      * @var string
  68.      * @ORM\Column(name="fStars", type="tHotelsFStars", nullable=true, options={"default":NULL})
  69.      */
  70.     private $stars;
  71.     /**
  72.      * @var string
  73.      * @ORM\Column(name="fStarsAdd", type="tHotelsFStarsAdd", nullable=true, options={"default":NULL})
  74.      */
  75.     private $starsAdd;
  76.     /**
  77.      * @var string
  78.      * @ORM\Column(name="fCat", type="tHotelsFCat", options={"default":"city"})
  79.      */
  80.     private $cat;
  81.     /**
  82.      * @var string
  83.      * @ORM\Column(name="fBeach", type="tHotelsFBeach", options={"default":"unknown"})
  84.      */
  85.     private $beach;
  86.     /**
  87.      * @var string
  88.      * @ORM\Column(name="fForm", type="tHotelsFForm", options={"default":"hotel"})
  89.      */
  90.     private $form;
  91.     /**
  92.      * @var integer
  93.      * @ORM\Column(name="fArea", type="integer", length=7, options={"unsigned":true, "comment":"площадь территории"})
  94.      */
  95.     private $area;
  96.     /**
  97.      * @var integer
  98.      * @ORM\Column(name="fPriority", type="smallint", length=2, options={"unsigned":true, "comment":"приоритет"})
  99.      */
  100.     private $priority;
  101.     /**
  102.      * @var float
  103.      * @ORM\Column(name="fSouthWest", type="decimal", precision=8, scale=5, options={"default":NULL}, nullable=true)
  104.      */
  105.     private $southWest;
  106.     /**
  107.      * @var float
  108.      * @ORM\Column(name="fNorthEast", type="decimal", precision=8, scale=5, options={"default":NULL}, nullable=true)
  109.      */
  110.     private $northEast;
  111.     /**
  112.      * @var integer
  113.      * @ORM\Column(name="fZoom", type="smallint", length=3, options={"unsigned":true, "default":NULL}, nullable=true)
  114.      */
  115.     private $zoom;
  116.     /**
  117.      * @var boolean
  118.      * @ORM\Column(name="fPaid", type="boolean", options={"comment":"платный"})
  119.      */
  120.     private $paid;
  121.     /**
  122.      * @var string
  123.      * @ORM\Column(name="fActive", type="tHotelsFActive", options={"default":"new"})
  124.      */
  125.     private $active;
  126.     /**
  127.      * @var
  128.      * @ORM\Column(name="fRefsConfirm", type="datetime", nullable=true, options={"default":NULL, "comment":"Проверена актуальность информации"})
  129.      */
  130.     private $refsConfirm;
  131.     /**
  132.      * @var float
  133.      * @ORM\Column(name="fRating", type="decimal", precision=7, scale=4, options={"unsigned":true, "default":"0.0000", "comment":"рейтинг отеля на ТурПравде"})
  134.      */
  135.     private $rating;
  136.     /**
  137.      * @var integer
  138.      * @ORM\Column(name="fReviews", type="integer", length=5, options={"unsigned":true, "default":0, "comment":"количество отзывов на ТурПравде с оценками"})
  139.      */
  140.     private $reviews;
  141.     /**
  142.      * @var float
  143.      * @ORM\Column(name="fTopRate", type="decimal", precision=7, scale=4, options={"unsigned":true,"default":"0.0000", "comment":"интегральная оценка отеля"})
  144.      */
  145.     private $topRate;
  146.     /**
  147.      * @var string
  148.      * @ORM\Column(name="fAvgVotes", type="text", options={"comment":"средние оценки отеля по критериям"})
  149.      */
  150.     private $avgVotes;
  151.     /**
  152.      * @var integer
  153.      * @ORM\Column(name="fLastMsgType", type="smallint", options={"unsigned":true, "comment":"тип последнего сообщения в админке"})
  154.      */
  155.     private $lastMsgType;
  156.     /**
  157.      * @var
  158.      * @ORM\Column(name="fLastMsgDate", type="date", nullable=true, options={"default":NULL, "comment":"дата последнего сообщения в админке"})
  159.      */
  160.     private $lastMsgDate;
  161.     /**
  162.      * @var
  163.      * @ORM\Column(name="notFoundVideo", type="datetime", nullable=true, options={"default":NULL})
  164.      */
  165.     private $notFoundVideo;
  166.     /**
  167.      * @var integer
  168.      * @ORM\Column(name="people", type="integer", length=11, nullable=true, options={"default":NULL})
  169.      */
  170.     private $people;
  171.     /**
  172.      * @var integer
  173.      * @ORM\Column(name="children", type="integer", length=11, nullable=true, options={"default":NULL})
  174.      */
  175.     private $children;
  176.     /**
  177.      * @var integer
  178.      * @ORM\Column(name="seniors", type="integer", length=11, nullable=true, options={"default":NULL})
  179.      */
  180.     private $seniors;
  181.     /**
  182.      * @var integer
  183.      * @ORM\Column(name="busines", type="integer", length=11, nullable=true, options={"default":NULL})
  184.      */
  185.     private $busines;
  186.     /**
  187.      * @var integer
  188.      * @ORM\Column(name="single", type="integer", length=11, nullable=true, options={"default":NULL})
  189.      */
  190.     private $single;
  191.     /**
  192.      * @var City
  193.      * @ORM\ManyToOne(targetEntity="App\Entity\Otpusk\City", inversedBy="hotels")
  194.      * @ORM\JoinColumn(name="fCityID", referencedColumnName="rec_id")
  195.      */
  196.     private $city;
  197.     /**
  198.      * @ORM\ManyToOne(targetEntity="App\Entity\Otpusk\Chain", inversedBy="hotels")
  199.      * @ORM\JoinColumn(name="chainId", referencedColumnName="id")
  200.      */
  201.     private $chainId;
  202.     /**
  203.      * @ORM\OneToOne(targetEntity="App\Entity\Otpusk\HotelsRCache", cascade={"persist", "remove"}, fetch="LAZY")
  204.      * @ORM\JoinColumn(name="rec_id", referencedColumnName="id", nullable=true)
  205.      */
  206.     private $hotelsRCache;
  207.     /**
  208.      * @ORM\OneToMany(targetEntity="PriceIndex", mappedBy="hotel")
  209.      */
  210.     private $priceIndex;
  211.     /**
  212.      * @ORM\OneToMany(targetEntity="App\Entity\Otpusk\Image", mappedBy="hotel", cascade={"persist"}, fetch="EAGER")
  213.      */
  214.     private $images;
  215.     /**
  216.      * @ORM\Column(type="integer", nullable=true)
  217.      */
  218.     private $renovation;
  219.     /**
  220.      * @ORM\Column(name="fNameEng", type="string", length=128)
  221.      */
  222.     private $nameEng;
  223.     /**
  224.      * @ORM\Column(type="date", options={"comment":"дата последнего получения offer-а"}, nullable=true)
  225.      */
  226.     private $lastOfferAt;
  227.     /**
  228.      * @ORM\Column(name="fAdultAge", type="smallint", nullable=true)
  229.      */
  230.     private $adultAge;
  231.     /**
  232.      * @return City|null
  233.      */
  234.     public function getCity(): ?City
  235.     {
  236.         return $this->city;
  237.     }
  238.     /**
  239.      * @param City|null $city
  240.      * @return Hotel
  241.      */
  242.     public function setCity(?City $city): Hotel
  243.     {
  244.         $this->city $city;
  245.         return $this;
  246.     }
  247.     /**
  248.      * @return mixed
  249.      */
  250.     public function getLastUpdate()
  251.     {
  252.         return $this->lastUpdate;
  253.     }
  254.     /**
  255.      * @param mixed $lastUpdate
  256.      * @return Hotel
  257.      */
  258.     public function setLastUpdate($lastUpdate)
  259.     {
  260.         $this->lastUpdate $lastUpdate;
  261.         return $this;
  262.     }
  263.     /**
  264.      * @return int
  265.      */
  266.     public function getCityId(): int
  267.     {
  268.         return $this->cityId;
  269.     }
  270.     /**
  271.      * @param int $cityId
  272.      * @return Hotel
  273.      */
  274.     public function setCityId(int $cityId): Hotel
  275.     {
  276.         $this->cityId $cityId;
  277.         return $this;
  278.     }
  279.     /**
  280.      * @return string
  281.      */
  282.     public function getName(): string
  283.     {
  284.         if(!$this->name) {
  285.             return $this->getId();
  286.         }
  287.         return $this->name;
  288.     }
  289.     /**
  290.      * @param string $name
  291.      * @return Hotel
  292.      */
  293.     public function setName(string $name): Hotel
  294.     {
  295.         $this->name $name;
  296.         return $this;
  297.     }
  298.     /**
  299.      * @return string
  300.      */
  301.     public function getNameUkr(): string
  302.     {
  303.         return $this->nameUkr;
  304.     }
  305.     /**
  306.      * @param string $nameUkr
  307.      * @return Hotel
  308.      */
  309.     public function setNameUkr(string $nameUkr): Hotel
  310.     {
  311.         $this->nameUkr $nameUkr;
  312.         return $this;
  313.     }
  314.     /**
  315.      * @return string
  316.      */
  317.     public function getTranslit(): string
  318.     {
  319.         return $this->translit;
  320.     }
  321.     /**
  322.      * @param string $translit
  323.      * @return Hotel
  324.      */
  325.     public function setTranslit(string $translit): Hotel
  326.     {
  327.         $this->translit $translit;
  328.         return $this;
  329.     }
  330.     /**
  331.      * @return string
  332.      */
  333.     public function getTranslitRu(): string
  334.     {
  335.         return $this->translitRu;
  336.     }
  337.     /**
  338.      * @param string $translitRu
  339.      * @return Hotel
  340.      */
  341.     public function setTranslitRu(string $translitRu): Hotel
  342.     {
  343.         $this->translitRu $translitRu;
  344.         return $this;
  345.     }
  346.     /**
  347.      * @return string
  348.      */
  349.     public function getStars(): string
  350.     {
  351.         return $this->stars;
  352.     }
  353.     /**
  354.      * @param string $stars
  355.      * @return Hotel
  356.      */
  357.     public function setStars(string $stars): Hotel
  358.     {
  359.         $this->stars $stars;
  360.         return $this;
  361.     }
  362.     /**
  363.      * @return string
  364.      */
  365.     public function getStarsAdd(): string
  366.     {
  367.         return $this->starsAdd;
  368.     }
  369.     /**
  370.      * @param string $starsAdd
  371.      * @return Hotel
  372.      */
  373.     public function setStarsAdd(string $starsAdd): Hotel
  374.     {
  375.         $this->starsAdd $starsAdd;
  376.         return $this;
  377.     }
  378.     public function getAllStars()
  379.     {
  380.         $stars $this->getStars();
  381.         $additionalStars $this->getStarsAdd();
  382.         if(!empty($additionalStars) && $stars != $additionalStars){
  383.             return [$stars$additionalStars];
  384.         }else{
  385.             return [$stars];
  386.         }
  387.     }
  388.     /**
  389.      * @return string
  390.      */
  391.     public function getCat(): string
  392.     {
  393.         return $this->cat;
  394.     }
  395.     /**
  396.      * @param string $cat
  397.      * @return Hotel
  398.      */
  399.     public function setCat(string $cat): Hotel
  400.     {
  401.         $this->cat $cat;
  402.         return $this;
  403.     }
  404.     /**
  405.      * @return string
  406.      */
  407.     public function getBeach(): string
  408.     {
  409.         return $this->beach;
  410.     }
  411.     /**
  412.      * @param string $beach
  413.      * @return Hotel
  414.      */
  415.     public function setBeach(string $beach): Hotel
  416.     {
  417.         $this->beach $beach;
  418.         return $this;
  419.     }
  420.     /**
  421.      * @return string
  422.      */
  423.     public function getForm(): string
  424.     {
  425.         return $this->form;
  426.     }
  427.     /**
  428.      * @param string $form
  429.      * @return Hotel
  430.      */
  431.     public function setForm(string $form): Hotel
  432.     {
  433.         $this->form $form;
  434.         return $this;
  435.     }
  436.     /**
  437.      * @return int
  438.      */
  439.     public function getArea(): int
  440.     {
  441.         return $this->area;
  442.     }
  443.     /**
  444.      * @param int $area
  445.      * @return Hotel
  446.      */
  447.     public function setArea(int $area): Hotel
  448.     {
  449.         $this->area $area;
  450.         return $this;
  451.     }
  452.     /**
  453.      * @return int
  454.      */
  455.     public function getPriority(): int
  456.     {
  457.         return $this->priority;
  458.     }
  459.     /**
  460.      * @param int $priority
  461.      * @return Hotel
  462.      */
  463.     public function setPriority(int $priority): Hotel
  464.     {
  465.         $this->priority $priority;
  466.         return $this;
  467.     }
  468.     /**
  469.      * @return float|null
  470.      */
  471.     public function getSouthWest(): ?float
  472.     {
  473.         return $this->southWest;
  474.     }
  475.     /**
  476.      * @param float|null $southWest
  477.      * @return Hotel
  478.      */
  479.     public function setSouthWest(?float $southWest): Hotel
  480.     {
  481.         $this->southWest $southWest;
  482.         return $this;
  483.     }
  484. /*
  485.  *
  486.  */
  487.     public function getNorthEast(): ?float
  488.     {
  489.         return $this->northEast;
  490.     }
  491.     /**
  492.      * @param float|null $northEast
  493.      * @return Hotel
  494.      */
  495.     public function setNorthEast(?float $northEast): Hotel
  496.     {
  497.         $this->northEast $northEast;
  498.         return $this;
  499.     }
  500.     /**
  501.      * @return int
  502.      */
  503.     public function getZoom(): int
  504.     {
  505.         return $this->zoom;
  506.     }
  507.     /**
  508.      * @param int $zoom
  509.      * @return Hotel
  510.      */
  511.     public function setZoom(int $zoom): Hotel
  512.     {
  513.         $this->zoom $zoom;
  514.         return $this;
  515.     }
  516.     /**
  517.      * @return bool
  518.      */
  519.     public function isPaid(): bool
  520.     {
  521.         return $this->paid;
  522.     }
  523.     /**
  524.      * @param bool $paid
  525.      * @return Hotel
  526.      */
  527.     public function setPaid(bool $paid): Hotel
  528.     {
  529.         $this->paid $paid;
  530.         return $this;
  531.     }
  532.     /**
  533.      * @return string
  534.      */
  535.     public function getActive(): string
  536.     {
  537.         return $this->active;
  538.     }
  539.     /**
  540.      * @param string $active
  541.      * @return Hotel
  542.      */
  543.     public function setActive(string $active): Hotel
  544.     {
  545.         $this->active $active;
  546.         return $this;
  547.     }
  548.     /**
  549.      * @return mixed
  550.      */
  551.     public function getRefsConfirm()
  552.     {
  553.         return $this->refsConfirm;
  554.     }
  555.     /**
  556.      * @param mixed $refsConfirm
  557.      * @return Hotel
  558.      */
  559.     public function setRefsConfirm($refsConfirm)
  560.     {
  561.         $this->refsConfirm $refsConfirm;
  562.         return $this;
  563.     }
  564.     /**
  565.      * @return float
  566.      */
  567.     public function getRating(): float
  568.     {
  569.         return $this->rating;
  570.     }
  571.     /**
  572.      * @param float $rating
  573.      * @return Hotel
  574.      */
  575.     public function setRating(float $rating): Hotel
  576.     {
  577.         $this->rating $rating;
  578.         return $this;
  579.     }
  580.     /**
  581.      * @return int
  582.      */
  583.     public function getReviews(): int
  584.     {
  585.         return $this->reviews;
  586.     }
  587.     /**
  588.      * @param int $reviews
  589.      * @return Hotel
  590.      */
  591.     public function setReviews(int $reviews): Hotel
  592.     {
  593.         $this->reviews $reviews;
  594.         return $this;
  595.     }
  596.     /**
  597.      * @return float
  598.      */
  599.     public function getTopRate(): float
  600.     {
  601.         return $this->topRate;
  602.     }
  603.     /**
  604.      * @param float $topRate
  605.      * @return Hotel
  606.      */
  607.     public function setTopRate(float $topRate): Hotel
  608.     {
  609.         $this->topRate $topRate;
  610.         return $this;
  611.     }
  612.     /**
  613.      * @return string
  614.      */
  615.     public function getAvgVotes(): string
  616.     {
  617.         return $this->avgVotes;
  618.     }
  619.     /**
  620.      * @param string $avgVotes
  621.      * @return Hotel
  622.      */
  623.     public function setAvgVotes(string $avgVotes): Hotel
  624.     {
  625.         $this->avgVotes $avgVotes;
  626.         return $this;
  627.     }
  628.     /**
  629.      * @return int
  630.      */
  631.     public function getLastMsgType(): int
  632.     {
  633.         return $this->lastMsgType;
  634.     }
  635.     /**
  636.      * @param int $lastMsgType
  637.      * @return Hotel
  638.      */
  639.     public function setLastMsgType(int $lastMsgType): Hotel
  640.     {
  641.         $this->lastMsgType $lastMsgType;
  642.         return $this;
  643.     }
  644.     /**
  645.      * @return mixed
  646.      */
  647.     public function getLastMsgDate()
  648.     {
  649.         return $this->lastMsgDate;
  650.     }
  651.     /**
  652.      * @param mixed $lastMsgDate
  653.      * @return Hotel
  654.      */
  655.     public function setLastMsgDate($lastMsgDate)
  656.     {
  657.         $this->lastMsgDate $lastMsgDate;
  658.         return $this;
  659.     }
  660.     /**
  661.      * @return mixed
  662.      */
  663.     public function getNotFoundVideo()
  664.     {
  665.         return $this->notFoundVideo;
  666.     }
  667.     /**
  668.      * @param mixed $notFoundVideo
  669.      * @return Hotel
  670.      */
  671.     public function setNotFoundVideo($notFoundVideo)
  672.     {
  673.         $this->notFoundVideo $notFoundVideo;
  674.         return $this;
  675.     }
  676.     /**
  677.      * @return int
  678.      */
  679.     public function getPeople(): int
  680.     {
  681.         return $this->people;
  682.     }
  683.     /**
  684.      * @param int $people
  685.      * @return Hotel
  686.      */
  687.     public function setPeople(int $people): Hotel
  688.     {
  689.         $this->people $people;
  690.         return $this;
  691.     }
  692.     /**
  693.      * @return int
  694.      */
  695.     public function getChildren(): int
  696.     {
  697.         return $this->children;
  698.     }
  699.     /**
  700.      * @param int $children
  701.      * @return Hotel
  702.      */
  703.     public function setChildren(int $children): Hotel
  704.     {
  705.         $this->children $children;
  706.         return $this;
  707.     }
  708.     /**
  709.      * @return int
  710.      */
  711.     public function getSeniors(): int
  712.     {
  713.         return $this->seniors;
  714.     }
  715.     /**
  716.      * @param int $seniors
  717.      * @return Hotel
  718.      */
  719.     public function setSeniors(int $seniors): Hotel
  720.     {
  721.         $this->seniors $seniors;
  722.         return $this;
  723.     }
  724.     /**
  725.      * @return int
  726.      */
  727.     public function getBusines(): int
  728.     {
  729.         return $this->busines;
  730.     }
  731.     /**
  732.      * @param int $busines
  733.      * @return Hotel
  734.      */
  735.     public function setBusines(int $busines): Hotel
  736.     {
  737.         $this->busines $busines;
  738.         return $this;
  739.     }
  740.     /**
  741.      * @return int
  742.      */
  743.     public function getSingle(): int
  744.     {
  745.         return $this->single;
  746.     }
  747.     /**
  748.      * @param int $single
  749.      * @return Hotel
  750.      */
  751.     public function setSingle(int $single): Hotel
  752.     {
  753.         $this->single $single;
  754.         return $this;
  755.     }
  756.     public function __toString()
  757.     {
  758.         return $this->getName().(isset($this->city)?', '.$this->getCity()->getName():'');
  759.     }
  760.     public static function getStarsLabels(){
  761.         return static::$hotelStars;
  762.     }
  763.     /**
  764.      * @ORM\OneToMany(targetEntity="App\Entity\Accounts\Favorites", mappedBy="hotel")
  765.      */
  766.     private Collection $favorites;
  767.     public function __construct()
  768.     {
  769.         $this->images = new ArrayCollection();
  770.         $this->favorites = new ArrayCollection();
  771.     }
  772.     public function getFavorites(): Collection
  773.     {
  774.         return $this->favorites;
  775.     }
  776.     public function getChainId(): ?Chain
  777.     {
  778.         return $this->chainId;
  779.     }
  780.     public function setChainId(?Chain $chainId): self
  781.     {
  782.         $this->chainId $chainId;
  783.         return $this;
  784.     }
  785.     public function getHotelsRCache(): ?HotelsRCache
  786.     {
  787.         return $this->hotelsRCache;
  788.     }
  789.     public function setHotelsRCache(?HotelsRCache $hotelsRCache): self
  790.     {
  791.         $this->hotelsRCache $hotelsRCache;
  792.         return $this;
  793.     }
  794.     public function getTypeWithFriends()
  795.     {
  796.         try {
  797.             return $this->hotelsRCache->getTypeWithFriends();
  798.         } catch (EntityNotFoundException $e){
  799.             return '';
  800.         }
  801.     }
  802.     public function getTypeRomanticRest()
  803.     {
  804.         try {
  805.             return $this->hotelsRCache->getTypeRomanticRest();
  806.         } catch (EntityNotFoundException $e){
  807.             return '';
  808.         }
  809.     }
  810.     public function getTypeWithChildren()
  811.     {
  812.         try {
  813.             return $this->hotelsRCache->getTypeWithChildren();
  814.         } catch (EntityNotFoundException $e){
  815.             return '';
  816.         }
  817.     }
  818.     public function getTypePeacfulRest()
  819.     {
  820.         try {
  821.             return $this->hotelsRCache->getTypePeacfulRest();
  822.         } catch (EntityNotFoundException $e){
  823.             return '';
  824.         }
  825.     }
  826.     /**
  827.      * @return mixed
  828.      */
  829.     public function getPriceIndex()
  830.     {
  831.         return $this->priceIndex;
  832.     }
  833.     /**
  834.      * @param mixed $priceIndex
  835.      */
  836.     public function setPriceIndex($priceIndex): void
  837.     {
  838.         $this->priceIndex $priceIndex;
  839.     }
  840.     /**
  841.      * @return Collection|Image[]
  842.      */
  843.     public function getImages(): Collection
  844.     {
  845. //        $tmp = new ArrayCollection();
  846. //        foreach ($this->images AS $key => $image) {
  847. ////            $id = $image->getId();
  848. //            $tmp->set($image->getId(), $image);
  849. //        }
  850. ////        $this->images = $tmp;
  851. ////        dd($tmp);
  852.         return $this->images;
  853.     }
  854.     public function addImage(Image $image): self
  855.     {
  856.         if (!$this->images->contains($image)) {
  857.             $this->images[] = $image;
  858.             $image->setHotel($this);
  859.         }
  860.         return $this;
  861.     }
  862.     public function removeImage(Image $image): self
  863.     {
  864.         if ($this->images->contains($image)) {
  865.             $this->images->removeElement($image);
  866.             // set the owning side to null (unless already changed)
  867.             if ($image->getHotel() === $this) {
  868.                 $image->setHotel(null);
  869.             }
  870.         }
  871.         return $this;
  872.     }
  873.     public function getStarsNumber()
  874.     {
  875.         $starsNumber = array(
  876.             'one'   => 1,
  877.             'two'   => 2,
  878.             'three' => 3,
  879.             'four'  => 4,
  880.             'five'  => 5,
  881.             'h2'  => 4,
  882.             'h1'  => 5,
  883.         );
  884.         if(array_key_exists($this->stars$starsNumber))
  885.             return $starsNumber[$this->stars];
  886.         return '';
  887.     }
  888.     public function getRenovation(): ?int
  889.     {
  890.         return $this->renovation;
  891.     }
  892.     public function setRenovation(?int $renovation): self
  893.     {
  894.         $this->renovation $renovation;
  895.         return $this;
  896.     }
  897.     public function getTypeLabel(): string
  898.     {
  899.         return self::LABEL_HOTEL;
  900.     }
  901.     
  902.     public function getNameEng(): ?string
  903.     {
  904.         return $this->nameEng;
  905.     }
  906.     public function setNameEng(string $nameEng): self
  907.     {
  908.         $this->nameEng $nameEng;
  909.         return $this;
  910.     }
  911.     public function getLastOfferAt(): ?\DateTimeInterface
  912.     {
  913.         return $this->lastOfferAt;
  914.     }
  915.     public function setLastOfferAt(?\DateTimeInterface $lastOfferAt): self
  916.     {
  917.         $this->lastOfferAt $lastOfferAt;
  918.         return $this;
  919.     }
  920.     public function getAdultAge(): ?int
  921.     {
  922.         return $this->adultAge;
  923.     }
  924.     public function setAdultAge(?int $adultAge): self
  925.     {
  926.         $this->adultAge $adultAge;
  927.         return $this;
  928.     }
  929. }