sterntours/trunk/src/AppBundle/Entity/FewoLodging.php
adametz a5eb342bd3 Update new Calender in Admin
git-svn-id: http://78.47.251.156/svn/dev/sterntours-3@3451 f459cee4-fb09-11de-96c3-f9c5f16c3c76
2018-08-21 14:39:31 +00:00

655 lines
13 KiB
PHP

<?php
namespace AppBundle\Entity;
use AppBundle\AppBundle;
use Symfony\Component\Validator\Constraints as Assert;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Table
* @ORM\Entity(repositoryClass="AppBundle\Entity\FewoLodgingRepository")
*/
class FewoLodging
{
//------------------------------------------------------------------------------------------------------------------
// Allgemein
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="name", type="string", length=255, nullable=false)
*/
private $name;
/**
* @var \AppBundle\Entity\FewoLodgingGroup
*
* @ORM\ManyToOne(targetEntity="FewoLodgingGroup")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="group_id", referencedColumnName="id")
* })
*/
private $group;
/**
* @var \AppBundle\Entity\FewoLodgingType
*
* @ORM\ManyToOne(targetEntity="FewoLodgingType")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="type_id", referencedColumnName="id")
* })
*/
private $type;
/**
* @var text
*
* @ORM\Column(name="description", type="text", nullable=false)
*/
private $description;
/**
* @var text
*
* @ORM\Column(name="equipment", type="text", nullable=false)
*/
private $equipment;
//------------------------------------------------------------------------------------------------------------------
// Adresse
/**
* @var string
*
* @ORM\Column(name="adress1", type="string", length=255, nullable=false)
*/
private $adress1;
/**
* @var string
*
* @ORM\Column(name="adress2", type="string", length=255, nullable=true)
*/
private $adress2;
/**
* @var string
*
* @ORM\Column(name="zip_code", type="string", length=255, nullable=false)
*/
private $zipCode;
/**
* @var string
*
* @ORM\Column(name="city", type="string", length=255, nullable=false)
*/
private $city;
//------------------------------------------------------------------------------------------------------------------
// Preise
/**
* @var integer
*
* @ORM\Column(name="maximum_persons", type="integer", nullable=false)
*/
private $maximumPersons;
/**
* @var float
*
* @ORM\Column(name="deposit", type="float", scale=2, nullable=false)
*/
private $deposit;
/**
* @var \AppBundle\Entity\FewoPrice
*
* @ORM\OneToMany(targetEntity="FewoPrice", mappedBy="lodging", cascade={"persist", "remove"})
*/
private $prices;
//------------------------------------------------------------------------------------------------------------------
// Bilder
/**
* @ORM\OneToMany(targetEntity="FewoLodgingImage", mappedBy="lodging", cascade={"persist", "remove"})
* @ORM\OrderBy({"pos" = "ASC"})
*/
private $images;
//------------------------------------------------------------------------------------------------------------------
// Kalender
/**
* @var \AppBundle\Entity\FewoReservation
*
* @ORM\OneToMany(targetEntity="FewoReservation", mappedBy="lodging", cascade={"persist", "remove"})
* @ORM\OrderBy({"fromDate" = "DESC"})
*/
private $reservations;
/**
* @var boolean
*
* @ORM\Column(name="calendar_visible", type="boolean", nullable=true)
*/
private $calendarVisible;
private $choosableSeasons;
/**
* @ORM\OneToOne(targetEntity="AppBundle\Entity\Page", mappedBy="fewoLodging")
*/
private $page;
public function getChoosableSeasons()
{
return $this->choosableSeasons;
}
public function setChoosableSeasons($choosableSeasons)
{
$this->choosableSeasons = $choosableSeasons;
}
public function getSeasons()
{
$prices = $this->getPrices();
$seasons = null;
for($i = 0; $i < count($prices); $i++)
{
$seasons[] = $prices->get($i)->getSeason();
}
return $seasons;
}
/**
* Constructor
*/
public function __construct()
{
$this->prices = new \Doctrine\Common\Collections\ArrayCollection();
$this->images = new \Doctrine\Common\Collections\ArrayCollection();
$this->reservations = new \Doctrine\Common\Collections\ArrayCollection();
}
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set name
*
* @param string $name
*
* @return FewoLodging
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* Get name
*
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Set description
*
* @param string $description
*
* @return FewoLodging
*/
public function setDescription($description)
{
$this->description = $description;
return $this;
}
/**
* Get description
*
* @return string
*/
public function getDescription()
{
return $this->description;
}
/**
* Set equipment
*
* @param string $equipment
*
* @return FewoLodging
*/
public function setEquipment($equipment)
{
$this->equipment = $equipment;
return $this;
}
/**
* Get equipment
*
* @return string
*/
public function getEquipment()
{
return $this->equipment;
}
/**
* Set adress1
*
* @param string $adress1
*
* @return FewoLodging
*/
public function setAdress1($adress1)
{
$this->adress1 = $adress1;
return $this;
}
/**
* Get adress1
*
* @return string
*/
public function getAdress1()
{
return $this->adress1;
}
/**
* Set adress2
*
* @param string $adress2
*
* @return FewoLodging
*/
public function setAdress2($adress2)
{
$this->adress2 = $adress2;
return $this;
}
/**
* Get adress2
*
* @return string
*/
public function getAdress2()
{
return $this->adress2;
}
/**
* Set zipCode
*
* @param string $zipCode
*
* @return FewoLodging
*/
public function setZipCode($zipCode)
{
$this->zipCode = $zipCode;
return $this;
}
/**
* Get zipCode
*
* @return string
*/
public function getZipCode()
{
return $this->zipCode;
}
/**
* Set city
*
* @param string $city
*
* @return FewoLodging
*/
public function setCity($city)
{
$this->city = $city;
return $this;
}
/**
* Get city
*
* @return string
*/
public function getCity()
{
return $this->city;
}
/**
* Set maximumPersons
*
* @param integer $maximumPersons
*
* @return FewoLodging
*/
public function setMaximumPersons($maximumPersons)
{
$this->maximumPersons = $maximumPersons;
return $this;
}
/**
* Get maximumPersons
*
* @return integer
*/
public function getMaximumPersons()
{
return $this->maximumPersons;
}
/**
* Set deposit
*
* @param float $deposit
*
* @return FewoLodging
*/
public function setDeposit($deposit)
{
$this->deposit = $deposit;
return $this;
}
/**
* Get deposit
*
* @return float
*/
public function getDeposit()
{
return $this->deposit;
}
/**
* Set calendarVisible
*
* @param boolean $calendarVisible
*
* @return FewoLodging
*/
public function setCalendarVisible($calendarVisible)
{
$this->calendarVisible = $calendarVisible;
return $this;
}
/**
* Get calendarVisible
*
* @return boolean
*/
public function getCalendarVisible()
{
return $this->calendarVisible;
}
/**
* Set type
*
* @param \AppBundle\Entity\FewoLodgingGroup $group
*
* @return FewoLodging
*/
public function setGroup(\AppBundle\Entity\FewoLodgingGroup $group = null)
{
$this->group = $group;
return $this;
}
/**
* Get type
*
* @return \AppBundle\Entity\FewoLodgingGroup
*/
public function getGroup()
{
return $this->group;
}
/**
* Set type
*
* @param \AppBundle\Entity\FewoLodgingType $type
*
* @return FewoLodging
*/
public function setType(\AppBundle\Entity\FewoLodgingType $type = null)
{
$this->type = $type;
return $this;
}
/**
* Get type
*
* @return \AppBundle\Entity\FewoLodgingType
*/
public function getType()
{
return $this->type;
}
/**
* Add price
*
* @param \AppBundle\Entity\FewoPrice $price
*
* @return FewoLodging
*/
public function addPrice(\AppBundle\Entity\FewoPrice $price)
{
$this->prices[] = $price;
return $this;
}
/**
* Remove price
*
* @param \AppBundle\Entity\FewoPrice $price
*/
public function removePrice(\AppBundle\Entity\FewoPrice $price)
{
$this->prices->removeElement($price);
}
/**
* Get prices
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getPrices()
{
return $this->prices;
}
/**
* Get prices
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getPricesFilter($dateFrom, $dateTo)
{
return $this->getPrices()->filter(function(FewoPrice $price) use ($dateFrom, $dateTo) {
if(!empty($price->getSeason()))
return ($price->getSeason()->getFromDate() >= $dateFrom && $price->getSeason()->getFromDate() <= $dateTo) ||
($price->getSeason()->getToDate() >= $dateFrom && $price->getSeason()->getToDate() <= $dateTo);
});
}
/**
* Add image
*
* @param \AppBundle\Entity\FewoLodgingImage $image
*
* @return FewoLodging
*/
public function addImage(\AppBundle\Entity\FewoLodgingImage $image)
{
$this->images[] = $image;
return $this;
}
/**
* Remove image
*
* @param \AppBundle\Entity\FewoLodgingImage $image
*/
public function removeImage(\AppBundle\Entity\FewoLodgingImage $image)
{
$this->images->removeElement($image);
}
/**
* Get images
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getImages()
{
return $this->images;
}
/**
* Add reservation
*
* @param \AppBundle\Entity\FewoReservation $reservation
*
* @return FewoLodging
*/
public function addReservation(\AppBundle\Entity\FewoReservation $reservation)
{
$this->reservations[] = $reservation;
return $this;
}
/**
* Remove reservation
*
* @param \AppBundle\Entity\FewoReservation $reservation
*/
public function removeReservation(\AppBundle\Entity\FewoReservation $reservation)
{
$this->reservations->removeElement($reservation);
}
/**
* Get reservations
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getReservations()
{
return $this->reservations;
}
/**
* Get reservationsFilter
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getReservationsFilter($dateFrom, $dateTo)
{
return $this->getReservations()->filter(function(FewoReservation $reservation) use ($dateFrom, $dateTo) {
return ($reservation->getFromDate() >= $dateFrom && $reservation->getFromDate() <= $dateTo) ||
($reservation->getToDate() >= $dateFrom && $reservation->getToDate() <= $dateTo);
});
}
/**
* Set page
*
* @param \AppBundle\Entity\Page $page
*
* @return FewoLodging
*/
public function setPage(\AppBundle\Entity\Page $page = null)
{
$this->page = $page;
return $this;
}
/**
* Get page
*
* @return \AppBundle\Entity\Page
*/
public function getPage()
{
return $this->page;
}
function __toString()
{
return $this->name;
}
}