<?php
namespace App\Entity\Otpusk;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass="App\Repository\Otpusk\HotelsRCacheRepository")
*
* @ORM\Table(
* name="hotelsRCache",
* indexes={
* @ORM\Index(name="type_romantic_rest", columns={"type_romantic_rest"}),
* @ORM\Index(name="type_peaceful_rest", columns={"type_peaceful_rest"}),
* @ORM\Index(name="name", columns={"name"}),
* @ORM\Index(name="rating", columns={"rating", "reviews"}),
* @ORM\Index(name="cat", columns={"cat"}),
* @ORM\Index(name="id", columns={"countryId", "cityId"}),
* @ORM\Index(name="rating_ext", columns={"rating_avg"}),
* @ORM\Index(name="chainId", columns={"chainId"}),
* @ORM\Index(name="stars", columns={"stars", "starsAdd"}),
* @ORM\Index(name="type_with_children", columns={"type_with_children"}),
* @ORM\Index(name="cityId", columns={"cityId"}),
* @ORM\Index(name="type_with_friends", columns={"type_with_friends"}),
* @ORM\Index(name="area", columns={"area"}),
* @ORM\Index(name="lastDate", columns={"lastDate"}),
* @ORM\Index(name="form", columns={"form"}),
* @ORM\Index(name="lastOfferAt", columns={"countryId", "lastOfferAt"}),
* @ORM\Index(name="vrein_testible_combined_1", columns={"id", "countryId", "stars"})
* },
* )
*/
class HotelsRCache
{
/**
* Sites' name for rating
* @var array
*/
const _SITENAMES = array(
1 => 'tripadvisor',
2 => 'tophotels',
3 => 'booking',
4 => 'turpravda',
);
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(name="id", type="integer", options={"unsigned"=true})
*/
private $id;
/**
* @ORM\Column(type="string", length=100)
*/
private $name;
/**
* @ORM\Column(type="string", length=100)
*/
private $nameUkr;
/**
* @ORM\Column(type="string", length=100)
*/
private $hrefName;
/**
* @ORM\Column(name="districtId", type="integer", options={"unsigned"=true}, nullable=true)
*/
private $district;
/**
* @ORM\Column(type="string", length=64)
*/
private $districtName;
/**
* @ORM\Column(type="string", length=64)
*/
private $districtNameUkr;
/**
* @ORM\Column(type="string", length=64)
*/
private $districtNameTr;
/**
* @ORM\Column(name="cityId", type="integer", options={"unsigned"=true})
*/
private $city;
/**
* @ORM\Column(type="string", length=64)
*/
private $cityCode;
/**
* @ORM\Column(type="string", length=64)
*/
private $cityName;
/**
* @ORM\Column(type="string", length=64)
*/
private $cityNameUkr;
/**
* @ORM\Column(name="provinceId", type="integer", options={"unsigned"=true}, nullable=true)
*/
private $province;
/**
* @ORM\Column(type="string", length=64)
*/
private $provinceName;
/**
* @ORM\Column(type="string", length=64)
*/
private $provinceNameUkr;
/**
* @ORM\Column(type="string", length=64)
*/
private $provinceNameTr;
/**
* @ORM\Column(name="countryId", type="smallint", options={"unsigned"=true})
*/
private $country;
/**
* @ORM\Column(type="string", length=2)
*/
private $countryCode;
/**
* @ORM\Column(type="string", length=64)
*/
private $countryHrefName;
/**
* @ORM\Column(type="string", length=64)
*/
private $countryName;
/**
* @ORM\Column(type="string", length=64)
*/
private $countryNameUkr;
/**
* @ORM\Column(type="string", type="hotelsRCacheCountryVisa", nullable=true)
*/
private $countryVisa;
/**
* @ORM\Column(type="string", type="hotelsRCacheCountryCurrency", nullable=false, options={"default":"usd"})
*/
private $countryCurrency;
/**
* @ORM\Column(type="string", type="hotelsRCacheCountryTransport", nullable=false, options={"default"="air"})
*/
private $countryTransport;
/**
* @ORM\Column(type="integer", options={"comment"="номер шарда на отпуске"})
*/
private $shard;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $about;
/**
* @ORM\Column(type="text", nullable=true, length=65535, options={"comment"="Описание на Укрианском"})
*/
private $aboutUkr;
/**
* @ORM\Column(type="text", length=65535, nullable=true)
*/
private $hotelService;
/**
* @ORM\Column(type="text")
*/
private $services;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $images;
/**
* @ORM\Column(type="smallint", nullable=false, options={"unsigned"=true})
*/
private $imageCount;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $image;
/**
* @ORM\Column(type="text", length=65535, nullable=true)
*/
private $video;
/**
* @ORM\Column(type="string", length=10, nullable=false)
*/
private $stars;
/**
* @ORM\Column(type="string", length=10, nullable=true)
*/
private $starsAdd;
/**
* @ORM\Column(type="string", type="hotelsRCacheCat")
*/
private $cat;
/**
* @ORM\Column(type="string", type="hotelsRCacheForm")
*/
private $form;
/**
* @ORM\Column(type="integer", nullable=false, options={"unsigned"=true,"comment"="площадь территории"})
*/
private $area;
/**
* @ORM\Column(type="decimal", precision=8, scale=5, nullable=true)
*/
private $lat;
/**
* @ORM\Column(type="decimal", precision=8, scale=5, nullable=true)
*/
private $long;
/**
* @ORM\Column(type="integer", nullable=true, options={"unsigned"=true})
*/
private $zoom;
/**
* @ORM\Column(type="integer", options={"unsigned"=true,"comment"="отзывы с ТП"})
*/
private $reviews;
/**
* @ORM\Column(type="integer", precision=5, options={"unsigned"=true,"comment"="среднее число отзывов из базы ratings"})
*/
private $reviews_avg;
/**
* @ORM\Column(type="decimal", precision=4, scale=2, options={"unsigned"=true,"comment"="рейтинг с ТП"})
*/
private $rating;
/**
* @ORM\Column(type="decimal", precision=5, scale=2, nullable=true, options={"unsigned"=true,"comment"="средний рейтинг из базы ratings"})
*/
private $rating_avg;
/**
* @ORM\Column(type="string", length=255, nullable=true, options={"comment"="посоветовали с ТП {people,children,seniors,busines,single}"})
*/
private $rates;
/**
* @ORM\Column(name="type_with_friends", type="decimal", precision=5, scale=2, nullable=true, options={"unsigned"=true,"comment"="Тип: Отдых с друзьями из базы ratings"})
*/
private $typeWithFriends;
/**
* @ORM\Column(name="type_romantic_rest", type="decimal", precision=5, scale=2, nullable=true, options={"unsigned"=true,"comment"="Тип: Отдых вдвоем из базы ratings"})
*/
private $typeRomanticRest;
/**
* @ORM\Column(name="type_with_children", type="decimal", precision=5, scale=2, nullable=true, options={"unsigned"=true,"comment"="Тип: Отдых с детьми из базы ratings"})
*/
private $typeWithChildren;
/**
* @ORM\Column(name="type_peaceful_rest", type="decimal", precision=5, scale=2, nullable=true, options={"unsigned"=true,"comment"="Тип: Спокойный отдых из базы ratings"})
*/
private $typePeacfulRest;
/**
* @ORM\Column(type="text", nullable=true, length=65535, options={"comment"="оценки с ТП"})
*/
private $votes;
/**
* @ORM\Column(type="datetime", nullable=false, options={"comment"="дата последней правки"})
*/
private $lastUpdate;
/**
* @ORM\Column(name="lastDate", type="datetime", nullable=false, options={"comment"="дата последнего обновления"})
*/
private $lastDate;
/**
* @ORM\Column(name="rating_by_site", type="text", nullable=true, length=65535, options={"comment"="Рейтинги по сайтам"})
*/
private $ratingBySite;
/**
* @ORM\Column(type="text", length=65535, nullable=true, options={"comment"="Медали"})
*/
private $badges;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Otpusk\HotTravels", mappedBy="hotelsRCache")
*/
private $hotTravels;
/**
* @var string
*
* @ORM\Column(name="nameAlt", type="string", length=500, nullable=false)
*/
private $namealt;
/**
* @var string
*
* @ORM\Column(name="cityNamePr", type="string", length=64, nullable=false)
*/
private $citynamepr;
/**
* @var string
*
* @ORM\Column(name="cityNameUkrPr", type="string", length=64, nullable=false)
*/
private $citynameukrpr;
/**
* @var int|null
*
* @ORM\Column(name="chainId", type="integer", nullable=true, options={"comment"="Номер сети отелей"})
*/
private $chainid;
/**
* @var string|null
*
* @ORM\Column(name="chainName", type="string", length=255, nullable=true, options={"comment"="Название сети отелей"})
*/
private $chainname;
/**
* @var string|null
*
* @ORM\Column(name="offer", type="string", length=500, nullable=true, options={"comment"="минимальная цена"})
*/
private $offer;
/**
* @ORM\Column(type="smallint", nullable=true)
*/
private $top100city;
/**
* @ORM\Column(type="smallint", nullable=true)
*/
private $top100country;
/**
* @ORM\Column(type="string", length=100)
*/
private $nameEng;
/**
* @ORM\Column(type="date", options={"comment":"дата последнего получения offer-а"}, nullable=true)
*/
private $lastOfferAt;
/**
* @ORM\Column(type="smallint", nullable=true)
*/
private $adultAge;
public function __construct()
{
$this->hotTravels = new ArrayCollection();
}
/**
* @return Collection|HotTravels[]
*/
public function getHotTravels(): Collection
{
return $this->hotTravels;
}
public function addHotTravels(HotTravels $hotTravels): self
{
if (!$this->hotTravels->contains($hotTravels)) {
$this->hotTravels[] = $hotTravels;
$hotTravels->setHotelsRCache($this);
}
return $this;
}
public function removeHotel(HotTravels $hotTravels): self
{
if ($this->hotTravels->contains($hotTravels)) {
$this->hotTravels->removeElement($hotTravels);
// set the owning side to null (unless already changed)
if ($hotTravels->getHotelsRCache() === $this) {
$hotTravels->setHotelsRCache(null);
}
}
return $this;
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getNameUkr(): ?string
{
return $this->nameUkr;
}
public function setNameUkr(string $nameUkr): self
{
$this->nameUkr = $nameUkr;
return $this;
}
public function getHrefName(): ?string
{
return $this->hrefName;
}
public function setHrefName(string $hrefName): self
{
$this->hrefName = $hrefName;
return $this;
}
public function getCity(): ?City
{
return $this->city;
}
public function setCity(?City $city): self
{
$this->city = $city;
return $this;
}
public function getCityCode(): ?string
{
return $this->cityCode;
}
public function setCityCode(string $cityCode): self
{
$this->cityCode = $cityCode;
return $this;
}
public function getCityName(): ?string
{
return $this->cityName;
}
public function setCityName(string $cityName): self
{
$this->cityName = $cityName;
return $this;
}
public function getCityNameUkr(): ?string
{
return $this->cityNameUkr;
}
public function setCityNameUkr(string $cityNameUkr): self
{
$this->cityNameUkr = $cityNameUkr;
return $this;
}
public function getCountry(): ?Country
{
return $this->country;
}
public function setCountry(?Country $country): self
{
$this->country = $country;
return $this;
}
public function getCountryCode(): ?string
{
return $this->countryCode;
}
public function setCountryCode(string $countryCode): self
{
$this->countryCode = $countryCode;
return $this;
}
public function getCountryHrefName(): ?string
{
return $this->countryHrefName;
}
public function setCountryHrefName(string $countryHrefName): self
{
$this->countryHrefName = $countryHrefName;
return $this;
}
public function getCountryName(): ?string
{
return $this->countryName;
}
public function setCountryName(string $countryName): self
{
$this->countryName = $countryName;
return $this;
}
public function getCountryNameUkr(): ?string
{
return $this->countryNameUkr;
}
public function setCountryNameUkr(string $countryNameUkr): self
{
$this->countryNameUkr = $countryNameUkr;
return $this;
}
public function getCountryVisa(): ?string
{
return $this->countryVisa;
}
public function setCountryVisa(?string $countryVisa): self
{
$this->countryVisa = $countryVisa;
return $this;
}
public function getCountryCurrency(): ?string
{
return $this->countryCurrency;
}
public function setCountryCurrency(string $countryCurrency): self
{
$this->countryCurrency = $countryCurrency;
return $this;
}
public function getCountryTransport(): ?string
{
return $this->countryTransport;
}
public function setCountryTransport(string $countryTransport): self
{
$this->countryTransport = $countryTransport;
return $this;
}
public function getShard(): ?int
{
return $this->shard;
}
public function setShard(int $shard): self
{
$this->shard = $shard;
return $this;
}
public function getAbout(): ?string
{
return $this->about;
}
public function setAbout(?string $about): self
{
$this->about = $about;
return $this;
}
public function getAboutUkr(): ?string
{
return $this->aboutUkr;
}
public function setAboutUkr(?string $aboutUkr): self
{
$this->aboutUkr = $aboutUkr;
return $this;
}
public function getHotelService(): ?string
{
return $this->hotelService;
}
public function setHotelService(string $hotelService): self
{
$this->hotelService = $hotelService;
return $this;
}
public function getServices(): ?string
{
return $this->services;
}
public function setServices(string $services): self
{
$this->services = $services;
return $this;
}
public function getImages(): ?string
{
return $this->images;
}
public function setImages(?string $images): self
{
$this->images = $images;
return $this;
}
public function getImageCount(): ?int
{
return $this->imageCount;
}
public function setImageCount(int $imageCount): self
{
$this->imageCount = $imageCount;
return $this;
}
public function getImage(): ?string
{
return $this->image;
}
public function setImage(string $image): self
{
$this->image = $image;
return $this;
}
public function getVideo(): ?string
{
return $this->video;
}
public function setVideo(string $video): self
{
$this->video = $video;
return $this;
}
public function getStars(): ?string
{
return $this->stars;
}
public function setStars(string $stars): self
{
$this->stars = $stars;
return $this;
}
public function getStarsAdd(): ?string
{
return $this->starsAdd;
}
public function setStarsAdd(?string $starsAdd): self
{
$this->starsAdd = $starsAdd;
return $this;
}
public function getCat(): ?string
{
return $this->cat;
}
public function setCat(string $cat): self
{
$this->cat = $cat;
return $this;
}
public function getForm(): ?string
{
return $this->form;
}
public function setForm(string $form): self
{
$this->form = $form;
return $this;
}
public function getArea(): ?int
{
return $this->area;
}
public function setArea(int $area): self
{
$this->area = $area;
return $this;
}
public function getLat(): ?string
{
return $this->lat;
}
public function setLat(?string $lat): self
{
$this->lat = $lat;
return $this;
}
public function getLong(): ?string
{
return $this->long;
}
public function setLong(?string $long): self
{
$this->long = $long;
return $this;
}
public function getZoom(): ?int
{
return $this->zoom;
}
public function setZoom(?int $zoom): self
{
$this->zoom = $zoom;
return $this;
}
public function getReviews(): ?int
{
return $this->reviews;
}
public function setReviews(int $reviews): self
{
$this->reviews = $reviews;
return $this;
}
public function getReviewsAvg(): ?int
{
return $this->reviews_avg;
}
public function getRating(): ?string
{
return $this->rating;
}
public function setRating(string $rating): self
{
$this->rating = $rating;
return $this;
}
public function getRatingAvg(): ?string
{
return $this->rating_avg;
}
public function setRatingAvg(string $rating_avg): self
{
$this->rating_avg = $rating_avg;
return $this;
}
public function getRates(): ?string
{
return $this->rates;
}
public function setRates(string $rates): self
{
$this->rates = $rates;
return $this;
}
public function getTypeWithFriends(): ?string
{
return $this->typeWithFriends;
}
public function setTypeWithFriends(string $typeWithFriends): self
{
$this->typeWithFriends = $typeWithFriends;
return $this;
}
public function getTypeRomanticRest(): ?string
{
return $this->typeRomanticRest;
}
public function setTypeRomanticRest(string $typeRomanticRest): self
{
$this->typeRomanticRest = $typeRomanticRest;
return $this;
}
public function getTypeWithChildren(): ?string
{
return $this->typeWithChildren;
}
public function setTypeWithChildren(string $typeWithChildren): self
{
$this->typeWithChildren = $typeWithChildren;
return $this;
}
public function getTypePeacfulRest(): ?string
{
return $this->typePeacfulRest;
}
public function setTypePeacfulRest(string $typePeacfulRest): self
{
$this->typePeacfulRest = $typePeacfulRest;
return $this;
}
public function getVotes(): ?string
{
return $this->votes;
}
public function setVotes(?string $votes): self
{
$this->votes = $votes;
return $this;
}
public function getLastUpdate(): ?\DateTimeInterface
{
return $this->lastUpdate;
}
public function setLastUpdate(\DateTimeInterface $lastUpdate): self
{
$this->lastUpdate = $lastUpdate;
return $this;
}
public function getLastDate(): ?\DateTimeInterface
{
return $this->lastDate;
}
public function setLastDate(\DateTimeInterface $lastDate): self
{
$this->lastDate = $lastDate;
return $this;
}
public function getRatingBySite(): ?string
{
return $this->ratingBySite;
}
public function setRatingBySite(?string $ratingBySite): self
{
$this->ratingBySite = $ratingBySite;
return $this;
}
public function __toString()
{
return $this->getName();
}
public function getStarsImg()
{
return str_repeat('☆', (int)$this->getStars());
}
public function getRatingBySiteString()
{
$ratings = unserialize($this->ratingBySite);
$str = '';
if(is_array($ratings)){
foreach ($ratings as $key => $rating) {
if(array_key_exists($rating['site_id'], self::_SITENAMES)){
$str .= self::_SITENAMES[$rating['site_id']] . ' => ' . $rating['rating'] . ' из ' . $rating['reviews'] . ' отзывов; ';
}
}
}
return $str;
}
public function getBadges(): ?string
{
return $this->badges;
}
public function setBadges(?string $badges): self
{
$this->badges = $badges;
return $this;
}
public function getDistrict(): ?int
{
return $this->district;
}
public function setDistrict(?int $districtId): self
{
$this->district = $districtId;
return $this;
}
public function getProvinced(): ?int
{
return $this->province;
}
public function setProvince(?int $provinceId): self
{
$this->province = $provinceId;
return $this;
}
public function getDistrictName(): ?string
{
return $this->districtName;
}
public function setDistrictName(?string $districtName): self
{
$this->districtName = $districtName;
return $this;
}
public function getProvinceName(): ?string
{
return $this->provinceName;
}
public function setProvinceName(?string $provinceName): self
{
$this->provinceName = $provinceName;
return $this;
}
public function getDistrictNameUkr(): ?string
{
return $this->districtNameUkr;
}
public function setDistrictNameUkr(?string $districtNameUkr): self
{
$this->districtNameUkr = $districtNameUkr;
return $this;
}
public function getProvinceNameUkr(): ?string
{
return $this->provinceNameUkr;
}
public function setProvinceNameUkr(?string $provinceNameUkr): self
{
$this->provinceNameUkr = $provinceNameUkr;
return $this;
}
public function getProvinceNameTr(): ?string
{
return $this->provinceNameTr;
}
public function setProvinceNameTr(string $provinceNameTr): self
{
$this->provinceNameTr = $provinceNameTr;
return $this;
}
public function getDistrictNameTr(): ?string
{
return $this->districtNameTr;
}
public function setDistrictNameTr(string $districtNameTr): self
{
$this->districtNameTr = $districtNameTr;
return $this;
}
public function getTop100city(): ?int
{
return $this->top100city;
}
public function setTop100city(?int $top100city): self
{
$this->top100city = $top100city;
return $this;
}
public function getTop100country(): ?int
{
return $this->top100country;
}
public function setTop100country(?int $top100country): self
{
$this->top100country = $top100country;
return $this;
}
public function getNameEng(): ?string
{
return $this->nameEng;
}
public function setNameEng(string $nameEng): self
{
$this->nameEng = $nameEng;
return $this;
}
public function getLastOfferAt(): ?\DateTimeInterface
{
return $this->lastOfferAt;
}
public function setLastOfferAt(?\DateTimeInterface $lastOfferAt): self
{
$this->lastOfferAt = $lastOfferAt;
return $this;
}
public function getAdultAge(): ?int
{
return $this->adultAge;
}
public function setAdultAge(?int $adultAge): self
{
$this->adultAge = $adultAge;
return $this;
}
}