init without trunk
This commit is contained in:
parent
ed24ac4994
commit
bb809e7233
14652 changed files with 177862 additions and 94817 deletions
899
src/AppBundle/Entity/BookingRequest.php
Normal file
899
src/AppBundle/Entity/BookingRequest.php
Normal file
|
|
@ -0,0 +1,899 @@
|
|||
<?php
|
||||
/**
|
||||
* @author Ulrich Hecht <ulrich.hecht@hecht-software.de>
|
||||
* @date 12/16/2016
|
||||
*/
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
use AppBundle\Validator\Constraints as AppBundleAssert;
|
||||
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||
|
||||
/**
|
||||
* Class BookingRequest
|
||||
* @package AppBundle\Entity
|
||||
* @AppBundleAssert\BookingRequest
|
||||
*/
|
||||
class BookingRequest
|
||||
{
|
||||
// Used in SternToursCrmBookingExports, expected to be equivalent to sex (as defined in Traveler)
|
||||
const MR = 1;
|
||||
const MRS = 2;
|
||||
|
||||
/**
|
||||
* @var TravelDeparturePoint $departure
|
||||
*/
|
||||
private $departure;
|
||||
|
||||
private $singleRoomCount;
|
||||
|
||||
private $doubleRoomCount;
|
||||
|
||||
private $tripleRoomCount;
|
||||
|
||||
private $singleRoomChildCount;
|
||||
|
||||
private $doubleRoomChildCount;
|
||||
|
||||
private $tripleRoomChildCount;
|
||||
|
||||
|
||||
private $extraBookingDaysBefore;
|
||||
|
||||
private $extraBookingDaysAfter;
|
||||
|
||||
private $roomCount;
|
||||
|
||||
/**
|
||||
* @var TravelInsurance $insurance
|
||||
*/
|
||||
private $insurance;
|
||||
|
||||
private $comfort = false;
|
||||
|
||||
private $travelOptions = [];
|
||||
|
||||
private $salutation;
|
||||
|
||||
/**
|
||||
* @Assert\NotBlank()
|
||||
*/
|
||||
private $firstName;
|
||||
|
||||
/**
|
||||
* @Assert\NotBlank()
|
||||
*/
|
||||
private $lastName;
|
||||
|
||||
/**
|
||||
* @Assert\NotBlank()
|
||||
*/
|
||||
private $streetAddress;
|
||||
|
||||
/**
|
||||
* @Assert\NotBlank()
|
||||
*/
|
||||
private $zipCode;
|
||||
|
||||
/**
|
||||
* @Assert\NotBlank()
|
||||
*/
|
||||
private $city;
|
||||
|
||||
private $nation;
|
||||
|
||||
/**
|
||||
* @Assert\NotBlank()
|
||||
*/
|
||||
private $phone;
|
||||
|
||||
private $mobile;
|
||||
|
||||
/**
|
||||
* @Assert\NotBlank()
|
||||
*/
|
||||
private $email;
|
||||
|
||||
private $travelers = [];
|
||||
|
||||
private $singleRooms = [];
|
||||
private $doubleRooms = [];
|
||||
private $tripleRooms = [];
|
||||
|
||||
private $singleChildRooms = [];
|
||||
private $doubleChildRooms = [];
|
||||
private $tripleChildRooms = [];
|
||||
|
||||
private $notes;
|
||||
|
||||
/**
|
||||
* @Assert\IsTrue()
|
||||
*/
|
||||
private $acceptTerms = false;
|
||||
|
||||
private $acceptLegalRights = false;
|
||||
|
||||
private $acceptPrivacy = false;
|
||||
|
||||
/**
|
||||
* BookingRequest constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
for($i = 0; $i < 4; ++$i)
|
||||
{
|
||||
$this->singleRooms[] = new Room(1);
|
||||
}
|
||||
for($i = 0; $i < 4; ++$i)
|
||||
{
|
||||
$this->singleChildRooms[] = new Room(4);
|
||||
}
|
||||
for($i = 0; $i < 3; ++$i)
|
||||
{
|
||||
$this->doubleRooms[] = new Room(2);
|
||||
}
|
||||
for($i = 0; $i < 3; ++$i)
|
||||
{
|
||||
$this->doubleChildRooms[] = new Room(5);
|
||||
}
|
||||
for($i = 0; $i < 2; ++$i)
|
||||
{
|
||||
$this->tripleRooms[] = new Room(3);
|
||||
}
|
||||
for($i = 0; $i < 2; ++$i)
|
||||
{
|
||||
$this->tripleChildRooms[] = new Room(6);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return TravelDeparturePoint
|
||||
*/
|
||||
public function getDeparture()
|
||||
{
|
||||
return $this->departure;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param TravelDeparturePoint $departure
|
||||
*/
|
||||
public function setDeparture(TravelDeparturePoint $departure)
|
||||
{
|
||||
$this->departure = $departure;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getTravelerCount()
|
||||
{
|
||||
$allUsedTravelersCount = 0;
|
||||
for($i = 0; $i < $this->singleRoomCount; ++$i)
|
||||
{
|
||||
$allUsedTravelersCount += $this->singleRooms[$i]->getTravelerCount();
|
||||
}
|
||||
for($i = 0; $i < $this->singleRoomChildCount; ++$i)
|
||||
{
|
||||
$allUsedTravelersCount += $this->singleChildRooms[$i]->getTravelerCount();
|
||||
}
|
||||
|
||||
for($i = 0; $i < $this->doubleRoomCount; ++$i)
|
||||
{
|
||||
$allUsedTravelersCount += $this->doubleRooms[$i]->getTravelerCount();
|
||||
}
|
||||
for($i = 0; $i < $this->doubleRoomChildCount; ++$i)
|
||||
{
|
||||
$allUsedTravelersCount += $this->doubleChildRooms[$i]->getTravelerCount();
|
||||
}
|
||||
for($i = 0; $i < $this->tripleRoomCount; ++$i)
|
||||
{
|
||||
$allUsedTravelersCount += $this->tripleRooms[$i]->getTravelerCount();
|
||||
}
|
||||
for($i = 0; $i < $this->tripleRoomChildCount; ++$i)
|
||||
{
|
||||
$allUsedTravelersCount += $this->tripleChildRooms[$i]->getTravelerCount();
|
||||
}
|
||||
|
||||
return $allUsedTravelersCount;
|
||||
}
|
||||
|
||||
public function getChildrenCount()
|
||||
{
|
||||
$allUsedChildrenCount = 0;
|
||||
for($i = 0; $i < $this->singleRoomCount; ++$i)
|
||||
{
|
||||
$allUsedChildrenCount += 0;//$this->singleRooms[$i]->getTravelerCount();
|
||||
}
|
||||
for($i = 0; $i < $this->singleRoomChildCount; ++$i)
|
||||
{
|
||||
$allUsedChildrenCount += 1;//$this->singleRooms[$i]->getTravelerCount();
|
||||
}
|
||||
for($i = 0; $i < $this->doubleRoomCount; ++$i)
|
||||
{
|
||||
$allUsedChildrenCount += 0;//$this->singleRooms[$i]->getTravelerCount();
|
||||
}
|
||||
for($i = 0; $i < $this->doubleRoomChildCount; ++$i)
|
||||
{
|
||||
$allUsedChildrenCount += 1;//$this->singleRooms[$i]->getTravelerCount();
|
||||
}
|
||||
for($i = 0; $i < $this->tripleRoomCount; ++$i)
|
||||
{
|
||||
$allUsedChildrenCount += 0;//$this->singleRooms[$i]->getTravelerCount();
|
||||
}
|
||||
for($i = 0; $i < $this->tripleRoomChildCount; ++$i)
|
||||
{
|
||||
$allUsedChildrenCount += 1;//$this->singleRooms[$i]->getTravelerCount();
|
||||
}
|
||||
|
||||
return $allUsedChildrenCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $travelerCount
|
||||
*/
|
||||
public function setTravelerCount($travelerCount)
|
||||
{
|
||||
$this->travelerCount = $travelerCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getRoomCount()
|
||||
{
|
||||
return $this->roomCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $travelers
|
||||
*/
|
||||
public function setRoomCount($travelers)
|
||||
{
|
||||
// nicht so kompliziert
|
||||
// übliche Anzahl der Reisenden war 2 -> Standardraum: 1 Doppelzimmer
|
||||
$this->travelerCount = $travelers;
|
||||
if($travelers % 2 != 0)
|
||||
{
|
||||
$times = ($travelers - 1) / 2;
|
||||
$this->singleRoomCount = 1;
|
||||
$this->doubleRoomCount = $times;
|
||||
$this->tripleRoomCount = 0;
|
||||
$this->roomCount = $times + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$times = $travelers / 2;
|
||||
$this->singleRoomCount = 0;
|
||||
$this->doubleRoomCount = $times;
|
||||
$this->tripleRoomCount = 0;
|
||||
$this->roomCount = $times;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getSingleRoomCount()
|
||||
{
|
||||
return $this->singleRoomCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $singleRoomCount
|
||||
*/
|
||||
public function setSingleRoomCount($singleRoomCount)
|
||||
{
|
||||
$this->singleRoomCount = $singleRoomCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getDoubleRoomCount()
|
||||
{
|
||||
return $this->doubleRoomCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $doubleRoomCount
|
||||
*/
|
||||
public function setDoubleRoomCount($doubleRoomCount)
|
||||
{
|
||||
$this->doubleRoomCount = $doubleRoomCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getTripleRoomCount()
|
||||
{
|
||||
return $this->tripleRoomCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $tripleRoomCount
|
||||
*/
|
||||
public function setTripleRoomCount($tripleRoomCount)
|
||||
{
|
||||
$this->tripleRoomCount = $tripleRoomCount;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getSingleRoomChildCount()
|
||||
{
|
||||
return $this->singleRoomChildCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $singleRoomChildCount
|
||||
*/
|
||||
public function setSingleRoomChildCount($singleRoomChildCount)
|
||||
{
|
||||
$this->singleRoomChildCount = $singleRoomChildCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getDoubleRoomChildCount()
|
||||
{
|
||||
return $this->doubleRoomChildCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $doubleRoomChildCount
|
||||
*/
|
||||
public function setDoubleRoomChildCount($doubleRoomChildCount)
|
||||
{
|
||||
$this->doubleRoomChildCount = $doubleRoomChildCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getTripleRoomChildCount()
|
||||
{
|
||||
return $this->tripleRoomChildCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $tripleRoomChildCount
|
||||
*/
|
||||
public function setTripleRoomChildCount($tripleRoomChildCount)
|
||||
{
|
||||
$this->tripleRoomChildCount = $tripleRoomChildCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getExtraBookingDaysBefore()
|
||||
{
|
||||
return $this->extraBookingDaysBefore;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $extraBookingDaysBefore
|
||||
*/
|
||||
public function setExtraBookingDaysBefore($extraBookingDaysBefore)
|
||||
{
|
||||
$this->extraBookingDaysBefore = $extraBookingDaysBefore;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getExtraBookingDaysAfter()
|
||||
{
|
||||
return $this->extraBookingDaysAfter;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $extraBookingDaysAfter
|
||||
*/
|
||||
public function setExtraBookingDaysAfter($extraBookingDaysAfter)
|
||||
{
|
||||
$this->extraBookingDaysAfter = $extraBookingDaysAfter;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return TravelInsurance
|
||||
*/
|
||||
public function getInsurance()
|
||||
{
|
||||
return $this->insurance;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param TravelInsurance $insurance
|
||||
*/
|
||||
public function setInsurance(TravelInsurance $insurance)
|
||||
{
|
||||
$this->insurance = $insurance;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getComfort()
|
||||
{
|
||||
return $this->comfort;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $comfort
|
||||
*/
|
||||
public function setComfort($comfort)
|
||||
{
|
||||
$this->comfort = $comfort;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return TravelOption[]
|
||||
*/
|
||||
public function getTravelOptions()
|
||||
{
|
||||
return $this->travelOptions;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $travelOptions
|
||||
*/
|
||||
public function setTravelOptions($travelOptions)
|
||||
{
|
||||
$this->travelOptions = $travelOptions;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getSalutation()
|
||||
{
|
||||
return $this->salutation;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $salutation
|
||||
*/
|
||||
public function setSalutation($salutation)
|
||||
{
|
||||
$this->salutation = $salutation;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getFirstName()
|
||||
{
|
||||
return $this->firstName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $firstName
|
||||
*/
|
||||
public function setFirstName($firstName)
|
||||
{
|
||||
$this->firstName = $firstName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getLastName()
|
||||
{
|
||||
return $this->lastName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $lastName
|
||||
*/
|
||||
public function setLastName($lastName)
|
||||
{
|
||||
$this->lastName = $lastName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getStreetAddress()
|
||||
{
|
||||
return $this->streetAddress;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $streetAddress
|
||||
*/
|
||||
public function setStreetAddress($streetAddress)
|
||||
{
|
||||
$this->streetAddress = $streetAddress;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getZipCode()
|
||||
{
|
||||
return $this->zipCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $zipCode
|
||||
*/
|
||||
public function setZipCode($zipCode)
|
||||
{
|
||||
$this->zipCode = $zipCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCity()
|
||||
{
|
||||
return $this->city;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $city
|
||||
*/
|
||||
public function setCity($city)
|
||||
{
|
||||
$this->city = $city;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getNation()
|
||||
{
|
||||
return $this->nation;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $nation
|
||||
*/
|
||||
public function setNation($nation)
|
||||
{
|
||||
$this->nation = $nation;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getPhone()
|
||||
{
|
||||
return $this->phone;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $phone
|
||||
*/
|
||||
public function setPhone($phone)
|
||||
{
|
||||
$this->phone = $phone;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getMobile()
|
||||
{
|
||||
return $this->mobile;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $mobile
|
||||
*/
|
||||
public function setMobile($mobile)
|
||||
{
|
||||
$this->mobile = $mobile;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getEmail()
|
||||
{
|
||||
return $this->email;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $email
|
||||
*/
|
||||
public function setEmail($email)
|
||||
{
|
||||
$this->email = $email;
|
||||
}
|
||||
|
||||
// get und set der Travelers liegt jetzt in Room; sollte so nicht mehr verwendet werden!
|
||||
/**
|
||||
* @return Traveler[]
|
||||
*/
|
||||
public function getTravelers()
|
||||
{
|
||||
$allUsedTravelers = [];
|
||||
|
||||
// könnte man eventuell in eine for-Schleife packen, wenn man garantiert, dass es immer gleich viele Räume von jedem Typ gibt
|
||||
for ($i = 0; $i < $this->singleRoomCount; ++$i)
|
||||
{
|
||||
$allUsedTravelers = array_merge($allUsedTravelers, $this->singleRooms[$i]->getTravelers());
|
||||
}
|
||||
for ($i = 0; $i < $this->singleRoomChildCount; ++$i)
|
||||
{
|
||||
$allUsedTravelers = array_merge($allUsedTravelers, $this->singleChildRooms[$i]->getTravelers());
|
||||
}
|
||||
|
||||
for ($i = 0; $i < $this->doubleRoomCount; ++$i)
|
||||
{
|
||||
$allUsedTravelers = array_merge($allUsedTravelers, $this->doubleRooms[$i]->getTravelers());
|
||||
}
|
||||
for ($i = 0; $i < $this->doubleRoomChildCount; ++$i)
|
||||
{
|
||||
$allUsedTravelers = array_merge($allUsedTravelers, $this->doubleChildRooms[$i]->getTravelers());
|
||||
}
|
||||
for ($i = 0; $i < $this->tripleRoomCount; ++$i)
|
||||
{
|
||||
$allUsedTravelers = array_merge($allUsedTravelers, $this->tripleRooms[$i]->getTravelers());
|
||||
}
|
||||
for ($i = 0; $i < $this->tripleRoomChildCount; ++$i)
|
||||
{
|
||||
$allUsedTravelers = array_merge($allUsedTravelers, $this->tripleChildRooms[$i]->getTravelers());
|
||||
}
|
||||
|
||||
// $this->travelers = $allUsedTravelers; // schlecht, getter sollte kein setter sein
|
||||
// return $this->travelers; // aber wenn man es so verwenden würde, dann sollte man auch das verwenden
|
||||
return $allUsedTravelers;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Traveler[] $travelers
|
||||
*/
|
||||
public function setTravelers($travelers)
|
||||
{
|
||||
$this->travelers = $travelers;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Room[]
|
||||
*/
|
||||
public function getSingleRooms()
|
||||
{
|
||||
return $this->singleRooms;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Room[] $singleRooms
|
||||
*/
|
||||
public function setSingleRooms($singleRooms)
|
||||
{
|
||||
$this->singleRooms = $singleRooms;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Room[]
|
||||
*/
|
||||
public function getDoubleRooms()
|
||||
{
|
||||
return $this->doubleRooms;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Room[] $doubleRooms
|
||||
*/
|
||||
public function setDoubleRooms($doubleRooms)
|
||||
{
|
||||
$this->doubleRooms = $doubleRooms;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Room[]
|
||||
*/
|
||||
public function getTripleRooms()
|
||||
{
|
||||
return $this->tripleRooms;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Room[] $tripleRooms
|
||||
*/
|
||||
public function setTripleRooms($tripleRooms)
|
||||
{
|
||||
$this->tripleRooms = $tripleRooms;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Room[]
|
||||
*/
|
||||
public function getSingleChildRooms()
|
||||
{
|
||||
return $this->singleChildRooms;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Room[] $singleChildRooms
|
||||
*/
|
||||
public function setSingleChildRooms($singleChildRooms)
|
||||
{
|
||||
$this->singleChildRooms = $singleChildRooms;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Room[]
|
||||
*/
|
||||
public function getDoubleChildRooms()
|
||||
{
|
||||
return $this->doubleChildRooms;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Room[] $doubleChildRooms
|
||||
*/
|
||||
public function setDoubleChildRooms($doubleChildRooms)
|
||||
{
|
||||
$this->doubleChildRooms = $doubleChildRooms;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Room[]
|
||||
*/
|
||||
public function getTripleChildRooms()
|
||||
{
|
||||
return $this->tripleChildRooms;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Room[] $tripleChildRooms
|
||||
*/
|
||||
public function setTripleChildRooms($tripleChildRooms)
|
||||
{
|
||||
$this->tripleChildRooms = $tripleChildRooms;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Room[]
|
||||
*/
|
||||
public function getRooms()
|
||||
{
|
||||
$allRooms = [];
|
||||
$allRooms = array_merge($allRooms, $this->singleRooms);
|
||||
$allRooms = array_merge($allRooms, $this->singleChildRooms);
|
||||
$allRooms = array_merge($allRooms, $this->doubleRooms);
|
||||
$allRooms = array_merge($allRooms, $this->doubleChildRooms);
|
||||
$allRooms = array_merge($allRooms, $this->tripleRooms);
|
||||
$allRooms = array_merge($allRooms, $this->tripleChildRooms);
|
||||
|
||||
return $allRooms;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Room[] $tripleRooms
|
||||
*/
|
||||
public function setRooms($rooms)
|
||||
{
|
||||
// falls man es braucht, nachziehen und oder umstrukturieren (booking.html.twig)
|
||||
}
|
||||
|
||||
public function getOccupiedRooms()
|
||||
{
|
||||
$allRooms = [];
|
||||
for($i = 0; $i < $this->singleRoomCount; $i++)
|
||||
{
|
||||
$allRooms[] = $this->singleRooms[$i];
|
||||
//$allRooms = array_push($allRooms, $this->singleRooms[$i]);
|
||||
}
|
||||
for($i = 0; $i < $this->singleRoomChildCount; $i++)
|
||||
{
|
||||
$allRooms[] = $this->singleChildRooms[$i];
|
||||
//$allChildRooms = array_push($allChildRooms, $this->singleChildRooms[$i]);
|
||||
}
|
||||
for($i = 0; $i < $this->doubleRoomCount; $i++)
|
||||
{
|
||||
$allRooms[] = $this->doubleRooms[$i];
|
||||
//$allRooms = array_push($allRooms, $this->doubleRooms[$i]);
|
||||
}
|
||||
for($i = 0; $i < $this->doubleRoomChildCount; $i++)
|
||||
{
|
||||
$allRooms[] = $this->doubleChildRooms[$i];
|
||||
//$allChildRooms = array_push($allChildRooms, $this->doubleChildRooms[$i]);
|
||||
}
|
||||
for($i = 0; $i < $this->tripleRoomCount; $i++)
|
||||
{
|
||||
$allRooms[] = $this->tripleRooms[$i];
|
||||
//$allRooms = array_push($allRooms, $this->tripleRooms[$i]);
|
||||
}
|
||||
for($i = 0; $i < $this->tripleRoomChildCount; $i++)
|
||||
{
|
||||
$allRooms[] = $this->tripleChildRooms[$i];
|
||||
//$allChildRooms = array_push($allChildRooms, $this->tripleChildRooms[$i]);
|
||||
}
|
||||
return $allRooms;
|
||||
}
|
||||
|
||||
/*
|
||||
public function addTraveler(Traveler $traveler)
|
||||
{
|
||||
$this->travelers[] = $traveler;
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getNotes()
|
||||
{
|
||||
return $this->notes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $notes
|
||||
*/
|
||||
public function setNotes($notes)
|
||||
{
|
||||
$this->notes = $notes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isAcceptTerms()
|
||||
{
|
||||
return $this->acceptTerms;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $acceptTerms
|
||||
*/
|
||||
public function setAcceptTerms($acceptTerms)
|
||||
{
|
||||
$this->acceptTerms = $acceptTerms;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
|
||||
public function isAcceptLegalRights()
|
||||
{
|
||||
return $this->acceptLegalRights;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $acceptLegalRights
|
||||
*/
|
||||
|
||||
public function setAcceptLegalRights($acceptLegalRights)
|
||||
{
|
||||
$this->acceptLegalRights = $acceptLegalRights;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function isAcceptPrivacy()
|
||||
{
|
||||
return $this->acceptPrivacy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $acceptPrivacy
|
||||
*/
|
||||
public function setAcceptPrivacy($acceptPrivacy)
|
||||
{
|
||||
$this->acceptPrivacy = $acceptPrivacy;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @Assert\Callback
|
||||
*/
|
||||
public function validate(ExecutionContextInterface $context, $payload)
|
||||
{
|
||||
//$context->
|
||||
}
|
||||
}
|
||||
44
src/AppBundle/Entity/BreadcrumbEntry.php
Normal file
44
src/AppBundle/Entity/BreadcrumbEntry.php
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
/**
|
||||
* @author Ulrich Hecht <ulrich.hecht@hecht-software.de>
|
||||
* @date 12/08/2016
|
||||
*/
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
|
||||
class BreadcrumbEntry
|
||||
{
|
||||
private $title;
|
||||
private $url;
|
||||
|
||||
/**
|
||||
* BreadcrumbEntry constructor.
|
||||
*
|
||||
* @param $title
|
||||
* @param $url
|
||||
*/
|
||||
public function __construct($title, $url = null)
|
||||
{
|
||||
$this->title = $title;
|
||||
$this->url = $url;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return String
|
||||
*/
|
||||
public function getTitle()
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return String
|
||||
*/
|
||||
public function getUrl()
|
||||
{
|
||||
return $this->url;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
253
src/AppBundle/Entity/CMSContent.php
Normal file
253
src/AppBundle/Entity/CMSContent.php
Normal file
|
|
@ -0,0 +1,253 @@
|
|||
<?php
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
|
||||
/**
|
||||
* CMSContent
|
||||
*
|
||||
* @ORM\Table(name="c_m_s_contents")
|
||||
* @ORM\Entity(repositoryClass="AppBundle\Entity\CMSContentRepository")
|
||||
*/
|
||||
class CMSContent
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
*
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="name", type="string", length=255)
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="slug", type="string", length=255, unique=true)
|
||||
*/
|
||||
private $slug;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="field", type="string", length=10)
|
||||
*/
|
||||
private $field;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="text", type="string", length=255, nullable=true)
|
||||
*/
|
||||
private $text;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="full_text", type="text", nullable=true)
|
||||
*/
|
||||
private $fullText;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*
|
||||
* @ORM\Column(name="integer", type="integer", nullable=true)
|
||||
*/
|
||||
private $integer;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="decimal", type="decimal", precision=15, scale=2, nullable=true)
|
||||
*/
|
||||
private $decimal;
|
||||
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set name
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return CMSContent
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set slug
|
||||
*
|
||||
* @param string $slug
|
||||
*
|
||||
* @return CMSContent
|
||||
*/
|
||||
public function setSlug($slug)
|
||||
{
|
||||
$this->slug = $slug;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get slug
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSlug()
|
||||
{
|
||||
return $this->slug;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set field
|
||||
*
|
||||
* @param string $field
|
||||
*
|
||||
* @return CMSContent
|
||||
*/
|
||||
public function setField($field)
|
||||
{
|
||||
$this->field = $field;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get field
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getField()
|
||||
{
|
||||
return $this->field;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set text
|
||||
*
|
||||
* @param string $text
|
||||
*
|
||||
* @return CMSContent
|
||||
*/
|
||||
public function setText($text)
|
||||
{
|
||||
$this->text = $text;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get text
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getText()
|
||||
{
|
||||
return $this->text;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set fullText
|
||||
*
|
||||
* @param string $fullText
|
||||
*
|
||||
* @return CMSContent
|
||||
*/
|
||||
public function setFullText($fullText)
|
||||
{
|
||||
$this->fullText = $fullText;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get fullText
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFullText()
|
||||
{
|
||||
return $this->fullText;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set integer
|
||||
*
|
||||
* @param integer $integer
|
||||
*
|
||||
* @return CMSContent
|
||||
*/
|
||||
public function setInteger($integer)
|
||||
{
|
||||
$this->integer = $integer;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get integer
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getInteger()
|
||||
{
|
||||
return $this->integer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set decimal
|
||||
*
|
||||
* @param string $decimal
|
||||
*
|
||||
* @return CMSContent
|
||||
*/
|
||||
public function setDecimal($decimal)
|
||||
{
|
||||
$this->decimal = $decimal;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get decimal
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDecimal()
|
||||
{
|
||||
return $this->decimal;
|
||||
}
|
||||
}
|
||||
|
||||
25
src/AppBundle/Entity/CMSContentRepository.php
Normal file
25
src/AppBundle/Entity/CMSContentRepository.php
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
/**
|
||||
* CMSContentRepository
|
||||
*
|
||||
* This class was generated by the Doctrine ORM. Add your own custom
|
||||
* repository methods below.
|
||||
*/
|
||||
class CMSContentRepository extends \Doctrine\ORM\EntityRepository
|
||||
{
|
||||
|
||||
public function findBySlug($slug)
|
||||
{
|
||||
$qb = $this->getEntityManager()->createQueryBuilder();
|
||||
$qb->select('c');
|
||||
$qb->from('AppBundle:CMSContent', 'c');
|
||||
$qb->where('c.slug = :slug');
|
||||
$qb->setParameter('slug', $slug);
|
||||
$qb->setMaxResults(1);
|
||||
return $qb->getQuery()->getOneOrNullResult();
|
||||
|
||||
}
|
||||
}
|
||||
285
src/AppBundle/Entity/CMSInfo.php
Normal file
285
src/AppBundle/Entity/CMSInfo.php
Normal file
|
|
@ -0,0 +1,285 @@
|
|||
<?php
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
|
||||
/**
|
||||
* CMSInfo
|
||||
*
|
||||
* @ORM\Table(name="c_m_s_infos")
|
||||
* @ORM\Entity(repositoryClass="AppBundle\Entity\CMSInfoRepository")
|
||||
*/
|
||||
class CMSInfo
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
*
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="name", type="string", length=255)
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="slug", type="string", length=255, unique=true)
|
||||
*/
|
||||
private $slug;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="type", type="string", length=10)
|
||||
*/
|
||||
private $type;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="text", type="string", length=255, nullable=true)
|
||||
*/
|
||||
private $text;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="full_text", type="text", nullable=true)
|
||||
*/
|
||||
private $fullText;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*
|
||||
* @ORM\Column(name="integer", type="integer", nullable=true)
|
||||
*/
|
||||
private $integer;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="decimal", type="decimal", precision=15, scale=2, nullable=true)
|
||||
*/
|
||||
private $decimal;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="bool", type="boolean", nullable=true)
|
||||
*/
|
||||
private $bool;
|
||||
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set name
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return CMSInfo
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set slug
|
||||
*
|
||||
* @param string $slug
|
||||
*
|
||||
* @return CMSInfo
|
||||
*/
|
||||
public function setSlug($slug)
|
||||
{
|
||||
$this->slug = $slug;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get slug
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSlug()
|
||||
{
|
||||
return $this->slug;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set type
|
||||
*
|
||||
* @param string $type
|
||||
*
|
||||
* @return CMSInfo
|
||||
*/
|
||||
public function setType($type)
|
||||
{
|
||||
$this->type = $type;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set text
|
||||
*
|
||||
* @param string $text
|
||||
*
|
||||
* @return CMSInfo
|
||||
*/
|
||||
public function setText($text)
|
||||
{
|
||||
$this->text = $text;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get text
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getText()
|
||||
{
|
||||
return $this->text;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set fullText
|
||||
*
|
||||
* @param string $fullText
|
||||
*
|
||||
* @return CMSInfo
|
||||
*/
|
||||
public function setFullText($fullText)
|
||||
{
|
||||
$this->fullText = $fullText;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get fullText
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFullText()
|
||||
{
|
||||
return $this->fullText;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set integer
|
||||
*
|
||||
* @param integer $integer
|
||||
*
|
||||
* @return CMSInfo
|
||||
*/
|
||||
public function setInteger($integer)
|
||||
{
|
||||
$this->integer = $integer;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get integer
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getInteger()
|
||||
{
|
||||
return $this->integer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set decimal
|
||||
*
|
||||
* @param string $decimal
|
||||
*
|
||||
* @return CMSInfo
|
||||
*/
|
||||
public function setDecimal($decimal)
|
||||
{
|
||||
$this->decimal = $decimal;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get decimal
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDecimal()
|
||||
{
|
||||
return $this->decimal;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set bool
|
||||
*
|
||||
* @param string $bool
|
||||
*
|
||||
* @return CMSInfo
|
||||
*/
|
||||
public function setBool($bool)
|
||||
{
|
||||
$this->bool = $bool;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get bool
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getBool()
|
||||
{
|
||||
return $this->bool;
|
||||
}
|
||||
}
|
||||
|
||||
25
src/AppBundle/Entity/CMSInfoRepository.php
Normal file
25
src/AppBundle/Entity/CMSInfoRepository.php
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
/**
|
||||
* CMSContentRepository
|
||||
*
|
||||
* This class was generated by the Doctrine ORM. Add your own custom
|
||||
* repository methods below.
|
||||
*/
|
||||
class CMSInfoRepository extends \Doctrine\ORM\EntityRepository
|
||||
{
|
||||
|
||||
public function findBySlug($slug)
|
||||
{
|
||||
$qb = $this->getEntityManager()->createQueryBuilder();
|
||||
$qb->select('c');
|
||||
$qb->from('AppBundle:CMSContent', 'c');
|
||||
$qb->where('c.slug = :slug');
|
||||
$qb->setParameter('slug', $slug);
|
||||
$qb->setMaxResults(1);
|
||||
return $qb->getQuery()->getOneOrNullResult();
|
||||
|
||||
}
|
||||
}
|
||||
97
src/AppBundle/Entity/Catalog.php
Normal file
97
src/AppBundle/Entity/Catalog.php
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
<?php
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* Catalog
|
||||
*
|
||||
* @ORM\Table(name="catalog")
|
||||
* @ORM\Entity
|
||||
*/
|
||||
class Catalog
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="title", type="string", length=255, nullable=true)
|
||||
*/
|
||||
private $title;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="slug", type="string", length=255, nullable=true)
|
||||
*/
|
||||
private $slug;
|
||||
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="IDENTITY")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Set title
|
||||
*
|
||||
* @param string $title
|
||||
*
|
||||
* @return Catalog
|
||||
*/
|
||||
public function setTitle($title)
|
||||
{
|
||||
$this->title = $title;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get title
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle()
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set slug
|
||||
*
|
||||
* @param string $slug
|
||||
*
|
||||
* @return Catalog
|
||||
*/
|
||||
public function setSlug($slug)
|
||||
{
|
||||
$this->slug = $slug;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get slug
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSlug()
|
||||
{
|
||||
return $this->slug;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
}
|
||||
398
src/AppBundle/Entity/ContactRequest.php
Normal file
398
src/AppBundle/Entity/ContactRequest.php
Normal file
|
|
@ -0,0 +1,398 @@
|
|||
<?php
|
||||
/**
|
||||
* @author Ulrich Hecht <ulrich.hecht@hecht-software.de>
|
||||
* @date 02/21/2017
|
||||
*/
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
|
||||
class ContactRequest
|
||||
{
|
||||
const MR = 1;
|
||||
const MRS = 2;
|
||||
|
||||
/** @var int|null $salutation */
|
||||
private $salutation;
|
||||
|
||||
/** @var string|null $firstName */
|
||||
private $firstName;
|
||||
|
||||
/** @var string|null $lastName */
|
||||
private $lastName;
|
||||
|
||||
/** @var string|null $streetAddress */
|
||||
private $streetAddress;
|
||||
|
||||
/** @var string|null $zipCode */
|
||||
private $zipCode;
|
||||
|
||||
/** @var string|null $city */
|
||||
private $city;
|
||||
|
||||
/** @var int|null $nation */
|
||||
private $nation;
|
||||
|
||||
/** @var string|null $phone */
|
||||
private $phone;
|
||||
|
||||
/** @var string|null $mobilePhone */
|
||||
private $mobilePhone;
|
||||
|
||||
/** @var string|null $email */
|
||||
private $email;
|
||||
|
||||
/**
|
||||
* @var string|null $travelerCount */
|
||||
private $travelerCount;
|
||||
|
||||
/** @var string|null $notes */
|
||||
private $notes;
|
||||
|
||||
/** @var string|null $departure0 */
|
||||
private $departure0;
|
||||
|
||||
/** @var string|null $departure1 */
|
||||
private $departure1;
|
||||
|
||||
/** @var string|null $departure2 */
|
||||
private $departure2;
|
||||
|
||||
/** @var \DateTime|null $start */
|
||||
private $start;
|
||||
|
||||
/** @var \DateTime|null $end */
|
||||
private $end;
|
||||
|
||||
private $acceptPrivacy = false;
|
||||
|
||||
private $acceptProcessing = false;
|
||||
|
||||
/**
|
||||
* @var int|null $duration
|
||||
* @Assert\Type(type="integer", message="Bitte geben Sie eine gültige Ganzzahl für die Dauer in Tagen ein")
|
||||
*/
|
||||
private $duration;
|
||||
|
||||
/**
|
||||
* @return int|null
|
||||
*/
|
||||
public function getSalutation()
|
||||
{
|
||||
return $this->salutation;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int|null $salutation
|
||||
*/
|
||||
public function setSalutation($salutation)
|
||||
{
|
||||
$this->salutation = $salutation;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null|string
|
||||
*/
|
||||
public function getFirstName()
|
||||
{
|
||||
return $this->firstName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param null|string $firstName
|
||||
*/
|
||||
public function setFirstName($firstName)
|
||||
{
|
||||
$this->firstName = $firstName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null|string
|
||||
*/
|
||||
public function getLastName()
|
||||
{
|
||||
return $this->lastName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param null|string $lastName
|
||||
*/
|
||||
public function setLastName($lastName)
|
||||
{
|
||||
$this->lastName = $lastName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null|string
|
||||
*/
|
||||
public function getStreetAddress()
|
||||
{
|
||||
return $this->streetAddress;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param null|string $streetAddress
|
||||
*/
|
||||
public function setStreetAddress($streetAddress)
|
||||
{
|
||||
$this->streetAddress = $streetAddress;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null|string
|
||||
*/
|
||||
public function getZipCode()
|
||||
{
|
||||
return $this->zipCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param null|string $zipCode
|
||||
*/
|
||||
public function setZipCode($zipCode)
|
||||
{
|
||||
$this->zipCode = $zipCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null|string
|
||||
*/
|
||||
public function getCity()
|
||||
{
|
||||
return $this->city;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param null|string $city
|
||||
*/
|
||||
public function setCity($city)
|
||||
{
|
||||
$this->city = $city;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int|null
|
||||
*/
|
||||
public function getNation()
|
||||
{
|
||||
return $this->nation;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int|null $nation
|
||||
*/
|
||||
public function setNation($nation)
|
||||
{
|
||||
$this->nation = $nation;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null|string
|
||||
*/
|
||||
public function getPhone()
|
||||
{
|
||||
return $this->phone;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param null|string $phone
|
||||
*/
|
||||
public function setPhone($phone)
|
||||
{
|
||||
$this->phone = $phone;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null|string
|
||||
*/
|
||||
public function getMobilePhone()
|
||||
{
|
||||
return $this->mobilePhone;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param null|string $mobilePhone
|
||||
*/
|
||||
public function setMobilePhone($mobilePhone)
|
||||
{
|
||||
$this->mobilePhone = $mobilePhone;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null|string
|
||||
*/
|
||||
public function getEmail()
|
||||
{
|
||||
return $this->email;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param null|string $email
|
||||
*/
|
||||
public function setEmail($email)
|
||||
{
|
||||
$this->email = $email;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null|string
|
||||
*/
|
||||
public function getTravelerCount()
|
||||
{
|
||||
return $this->travelerCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param null|string $travelerCount
|
||||
*/
|
||||
public function setTravelerCount($travelerCount)
|
||||
{
|
||||
$this->travelerCount = $travelerCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null|string
|
||||
*/
|
||||
public function getNotes()
|
||||
{
|
||||
return $this->notes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param null|string $notes
|
||||
*/
|
||||
public function setNotes($notes)
|
||||
{
|
||||
$this->notes = $notes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null|string
|
||||
*/
|
||||
public function getDeparture0()
|
||||
{
|
||||
return $this->departure0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param null|string $departure0
|
||||
*/
|
||||
public function setDeparture0($departure0)
|
||||
{
|
||||
$this->departure0 = $departure0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null|string
|
||||
*/
|
||||
public function getDeparture1()
|
||||
{
|
||||
return $this->departure1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param null|string $departure1
|
||||
*/
|
||||
public function setDeparture1($departure1)
|
||||
{
|
||||
$this->departure1 = $departure1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null|string
|
||||
*/
|
||||
public function getDeparture2()
|
||||
{
|
||||
return $this->departure2;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param null|string $departure2
|
||||
*/
|
||||
public function setDeparture2($departure2)
|
||||
{
|
||||
$this->departure2 = $departure2;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \DateTime|null
|
||||
*/
|
||||
public function getStart()
|
||||
{
|
||||
return $this->start;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \DateTime|null $start
|
||||
*/
|
||||
public function setStart($start)
|
||||
{
|
||||
$this->start = $start;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \DateTime|null
|
||||
*/
|
||||
public function getEnd()
|
||||
{
|
||||
return $this->end;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \DateTime|null $end
|
||||
*/
|
||||
public function setEnd($end)
|
||||
{
|
||||
$this->end = $end;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int|null
|
||||
*/
|
||||
public function getDuration()
|
||||
{
|
||||
return $this->duration;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int|null $duration
|
||||
*/
|
||||
public function setDuration($duration)
|
||||
{
|
||||
$this->duration = $duration;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function isAcceptPrivacy()
|
||||
{
|
||||
return $this->acceptPrivacy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $acceptPrivacy
|
||||
*/
|
||||
public function setAcceptPrivacy($acceptPrivacy)
|
||||
{
|
||||
$this->acceptPrivacy = $acceptPrivacy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function isAcceptProcessing()
|
||||
{
|
||||
return $this->acceptProcessing;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $acceptProcessing
|
||||
*/
|
||||
public function setAcceptProcessing($acceptProcessing)
|
||||
{
|
||||
$this->acceptProcessing = $acceptProcessing;
|
||||
}
|
||||
}
|
||||
510
src/AppBundle/Entity/FewoBookingRequest.php
Normal file
510
src/AppBundle/Entity/FewoBookingRequest.php
Normal file
|
|
@ -0,0 +1,510 @@
|
|||
<?php
|
||||
/**
|
||||
* @author Ulrich Hecht <ulrich.hecht@hecht-software.de>
|
||||
* @date 12/16/2016
|
||||
*/
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
use AppBundle\Validator\Constraints as AppBundleAssert;
|
||||
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||
|
||||
//TODO im folgenden fehlt noch die Validierung
|
||||
/**
|
||||
* Class BookingRequest
|
||||
* @package AppBundle\Entity
|
||||
* @AppBundleAssert\FewoBookingRequest
|
||||
*/
|
||||
class FewoBookingRequest
|
||||
{
|
||||
// Used in SternToursCrmBookingExports, expected to be equivalent to sex (as defined in Traveler)
|
||||
const MR = 1;
|
||||
const MRS = 2;
|
||||
|
||||
/**
|
||||
* @Assert\DateTime()
|
||||
*/
|
||||
private $fromDate;
|
||||
|
||||
/**
|
||||
* @Assert\DateTime()
|
||||
*/
|
||||
private $toDate;
|
||||
|
||||
private $numberDays;
|
||||
|
||||
private $totalPrice;
|
||||
|
||||
private $salutation;
|
||||
|
||||
/**
|
||||
* @Assert\NotBlank()
|
||||
*/
|
||||
private $firstName;
|
||||
|
||||
/**
|
||||
* @Assert\NotBlank()
|
||||
*/
|
||||
private $lastName;
|
||||
|
||||
/**
|
||||
* @Assert\NotBlank()
|
||||
*/
|
||||
private $streetAddress;
|
||||
|
||||
/**
|
||||
* @Assert\NotBlank()
|
||||
*/
|
||||
private $zipCode;
|
||||
|
||||
/**
|
||||
* @Assert\NotBlank()
|
||||
*/
|
||||
private $city;
|
||||
|
||||
private $nation;
|
||||
|
||||
/**
|
||||
* @Assert\NotBlank()
|
||||
*/
|
||||
private $phone;
|
||||
|
||||
private $mobile;
|
||||
|
||||
/**
|
||||
* @Assert\NotBlank()
|
||||
*/
|
||||
private $email;
|
||||
|
||||
private $notes;
|
||||
|
||||
private $travelerCount;
|
||||
|
||||
private $travelerCountAdult;
|
||||
|
||||
|
||||
private $travelerCountChild;
|
||||
|
||||
|
||||
// private $acceptTerms = false;
|
||||
|
||||
private $acceptPrivacy = false;
|
||||
|
||||
private $acceptRentalConditions = false;
|
||||
|
||||
// private $acceptProcessing = false;
|
||||
|
||||
private $lodging;
|
||||
|
||||
private $season;
|
||||
|
||||
private $price;
|
||||
|
||||
/**
|
||||
* BookingRequest constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getFromDate()
|
||||
{
|
||||
return $this->fromDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $fromDate
|
||||
*/
|
||||
public function setFromDate($fromDate)
|
||||
{
|
||||
$this->fromDate = $fromDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getToDate()
|
||||
{
|
||||
return $this->toDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $toDate
|
||||
*/
|
||||
public function setToDate($toDate)
|
||||
{
|
||||
$this->toDate = $toDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getSalutation()
|
||||
{
|
||||
return $this->salutation;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $salutation
|
||||
*/
|
||||
public function setSalutation($salutation)
|
||||
{
|
||||
$this->salutation = $salutation;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getFirstName()
|
||||
{
|
||||
return $this->firstName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $firstName
|
||||
*/
|
||||
public function setFirstName($firstName)
|
||||
{
|
||||
$this->firstName = $firstName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getLastName()
|
||||
{
|
||||
return $this->lastName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $lastName
|
||||
*/
|
||||
public function setLastName($lastName)
|
||||
{
|
||||
$this->lastName = $lastName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getStreetAddress()
|
||||
{
|
||||
return $this->streetAddress;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $streetAddress
|
||||
*/
|
||||
public function setStreetAddress($streetAddress)
|
||||
{
|
||||
$this->streetAddress = $streetAddress;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getZipCode()
|
||||
{
|
||||
return $this->zipCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $zipCode
|
||||
*/
|
||||
public function setZipCode($zipCode)
|
||||
{
|
||||
$this->zipCode = $zipCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getCity()
|
||||
{
|
||||
return $this->city;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $city
|
||||
*/
|
||||
public function setCity($city)
|
||||
{
|
||||
$this->city = $city;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getNation()
|
||||
{
|
||||
return $this->nation;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $nation
|
||||
*/
|
||||
public function setNation($nation)
|
||||
{
|
||||
$this->nation = $nation;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getPhone()
|
||||
{
|
||||
return $this->phone;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $phone
|
||||
*/
|
||||
public function setPhone($phone)
|
||||
{
|
||||
$this->phone = $phone;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getMobile()
|
||||
{
|
||||
return $this->mobile;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $mobile
|
||||
*/
|
||||
public function setMobile($mobile)
|
||||
{
|
||||
$this->mobile = $mobile;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getEmail()
|
||||
{
|
||||
return $this->email;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $email
|
||||
*/
|
||||
public function setEmail($email)
|
||||
{
|
||||
$this->email = $email;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getNotes()
|
||||
{
|
||||
return $this->notes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $notes
|
||||
*/
|
||||
public function setNotes($notes)
|
||||
{
|
||||
$this->notes = $notes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getTravelerCount()
|
||||
{
|
||||
$this->travelerCount = $this->travelerCountAdult + $this->travelerCountChild;
|
||||
return $this->travelerCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $travelerCount
|
||||
*/
|
||||
public function setTravelerCount($travelerCount)
|
||||
{
|
||||
$this->travelerCount = $this->travelerCountAdult + $this->travelerCountChild;
|
||||
// $this->travelerCount = $travelerCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getTravelerCountAdult()
|
||||
{
|
||||
return $this->travelerCountAdult;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $travelerCountAdult
|
||||
*/
|
||||
public function setTravelerCountAdult($travelerCountAdult)
|
||||
{
|
||||
$this->travelerCountAdult = $travelerCountAdult;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getTravelerCountChild()
|
||||
{
|
||||
return $this->travelerCountChild;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $travelerCountChild
|
||||
*/
|
||||
public function setTravelerCountChild($travelerCountChild)
|
||||
{
|
||||
$this->travelerCountChild = $travelerCountChild;
|
||||
}
|
||||
|
||||
|
||||
/* public function getAcceptTerms()
|
||||
{
|
||||
return $this->acceptTerms;
|
||||
}
|
||||
|
||||
|
||||
public function setAcceptTerms($acceptTerms)
|
||||
{
|
||||
$this->acceptTerms = $acceptTerms;
|
||||
}
|
||||
*/
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function isAcceptPrivacy()
|
||||
{
|
||||
return $this->acceptPrivacy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $acceptPrivacy
|
||||
*/
|
||||
public function setAcceptPrivacy($acceptPrivacy)
|
||||
{
|
||||
$this->acceptPrivacy = $acceptPrivacy;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function isAcceptRentalConditions()
|
||||
{
|
||||
return $this->acceptRentalConditions;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $acceptRentalConditions
|
||||
*/
|
||||
public function setAcceptRentalConditions($acceptRentalConditions)
|
||||
{
|
||||
$this->acceptRentalConditions = $acceptRentalConditions;
|
||||
}
|
||||
/*
|
||||
public function isAcceptProcessing()
|
||||
{
|
||||
return $this->acceptProcessing;
|
||||
}
|
||||
|
||||
public function setAcceptProcessing($acceptProcessing)
|
||||
{
|
||||
$this->acceptProcessing = $acceptProcessing;
|
||||
}
|
||||
*/
|
||||
public function getNumberDays()
|
||||
{
|
||||
return $this->numberDays;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $numberDays
|
||||
*/
|
||||
public function setNumberDays($numberDays)
|
||||
{
|
||||
$this->numberDays = $numberDays;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getTotalPrice()
|
||||
{
|
||||
return $this->totalPrice;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $totalPrice
|
||||
*/
|
||||
public function setTotalPrice($totalPrice)
|
||||
{
|
||||
$this->totalPrice = $totalPrice;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return FewoLodging
|
||||
*/
|
||||
public function getLodging()
|
||||
{
|
||||
return $this->lodging;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FewoLodging $lodging
|
||||
*/
|
||||
public function setLodging($lodging)
|
||||
{
|
||||
$this->lodging = $lodging;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return FewoSeason
|
||||
*/
|
||||
public function getSeason()
|
||||
{
|
||||
return $this->season;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FewoSeason $season
|
||||
*/
|
||||
public function setSeason($season)
|
||||
{
|
||||
$this->season = $season;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return FewoPrice
|
||||
*/
|
||||
public function getPrice()
|
||||
{
|
||||
return $this->price;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FewoPrice $price
|
||||
*/
|
||||
public function setPrice($price)
|
||||
{
|
||||
$this->price = $price;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Assert\Callback
|
||||
*/
|
||||
public function validate(ExecutionContextInterface $context, $payload)
|
||||
{
|
||||
//$context->
|
||||
}
|
||||
|
||||
}
|
||||
755
src/AppBundle/Entity/FewoLodging.php
Normal file
755
src/AppBundle/Entity/FewoLodging.php
Normal file
|
|
@ -0,0 +1,755 @@
|
|||
<?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", inversedBy="lodgings")
|
||||
)
|
||||
* @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 integer
|
||||
*
|
||||
* @ORM\Column(name="maximum_adults", type="integer", nullable=false)
|
||||
*/
|
||||
private $maximumAdults;
|
||||
|
||||
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* @ORM\Column(name="maximum_childs", type="integer", nullable=false)
|
||||
*/
|
||||
private $maximumChilds;
|
||||
|
||||
/**
|
||||
* @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 maximumAdults
|
||||
*
|
||||
* @param integer $maximumAdults
|
||||
*
|
||||
* @return FewoLodging
|
||||
*/
|
||||
public function setMaximumAdults($maximumAdults)
|
||||
{
|
||||
$this->maximumAdults = $maximumAdults;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get maximumAdults
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getMaximumAdults()
|
||||
{
|
||||
return $this->maximumAdults;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set maximumChilds
|
||||
*
|
||||
* @param integer $maximumChilds
|
||||
*
|
||||
* @return FewoLodging
|
||||
*/
|
||||
public function setMaximumChilds($maximumChilds)
|
||||
{
|
||||
$this->maximumChilds = $maximumChilds;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get maximumChilds
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getMaximumChilds()
|
||||
{
|
||||
return $this->maximumChilds;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Price
|
||||
*
|
||||
* @param \Doctrine\Common\Collections\Collection
|
||||
*
|
||||
* @return FewoLodging
|
||||
*/
|
||||
public function setPrices($prices)
|
||||
{
|
||||
$this->prices = $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);
|
||||
});
|
||||
}
|
||||
|
||||
public function getPricesByFromDateFilter($fromDate)
|
||||
{
|
||||
return $this->getPrices()->filter(function(FewoPrice $price) use ($fromDate) {
|
||||
if(!empty($price->getSeason()))
|
||||
var_dump($price->getSeason()->getFromDate() );
|
||||
echo "<br>";
|
||||
return ($price->getSeason()->getFromDate() >= $fromDate && $price->getSeason()->getToDate() <= $fromDate);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get prices
|
||||
*
|
||||
* @return \Doctrine\Common\Collections\Collection
|
||||
*/
|
||||
public function getPricesFilterNow()
|
||||
{
|
||||
$now = new \DateTime();
|
||||
return $this->getPrices()->filter(function(FewoPrice $price) use ($now) {
|
||||
if(!empty($price->getSeason()))
|
||||
return ($price->getSeason()->getToDate() >= $now);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
}
|
||||
141
src/AppBundle/Entity/FewoLodgingGroup.php
Normal file
141
src/AppBundle/Entity/FewoLodgingGroup.php
Normal file
|
|
@ -0,0 +1,141 @@
|
|||
<?php
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
use AppBundle\AppBundle;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* @ORM\Table
|
||||
* @ORM\Entity
|
||||
*/
|
||||
class FewoLodgingGroup
|
||||
{
|
||||
/**
|
||||
* @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=true)
|
||||
*/
|
||||
private $name;
|
||||
|
||||
|
||||
/**
|
||||
* @ORM\OneToMany(targetEntity="FewoLodging", mappedBy="group", cascade={"persist", "remove"})
|
||||
*/
|
||||
private $lodgings;
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
// Bilder
|
||||
|
||||
/**
|
||||
* @ORM\OneToMany(targetEntity="FewoLodgingGroupImage", mappedBy="lodgingGroup", cascade={"persist", "remove"})
|
||||
* @ORM\OrderBy({"pos" = "ASC"})
|
||||
*/
|
||||
private $images;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->images = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get lodgings
|
||||
*
|
||||
* @return \Doctrine\Common\Collections\Collection
|
||||
*/
|
||||
public function getLodgings()
|
||||
{
|
||||
return $this->lodgings;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add image
|
||||
*
|
||||
* @param \AppBundle\Entity\FewoLodgingGroupImage $image
|
||||
*
|
||||
* @return FewoLodging
|
||||
*/
|
||||
public function addImage(\AppBundle\Entity\FewoLodgingGroupImage $image)
|
||||
{
|
||||
$this->images[] = $image;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove image
|
||||
*
|
||||
* @param \AppBundle\Entity\FewoLodgingGroupImage $image
|
||||
*/
|
||||
public function removeImage(\AppBundle\Entity\FewoLodgingGroupImage $image)
|
||||
{
|
||||
$this->images->removeElement($image);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get images
|
||||
*
|
||||
* @return \Doctrine\Common\Collections\Collection
|
||||
*/
|
||||
public function getImages()
|
||||
{
|
||||
return $this->images;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set name
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return FewoLodgingType
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
function __toString()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
234
src/AppBundle/Entity/FewoLodgingGroupImage.php
Normal file
234
src/AppBundle/Entity/FewoLodgingGroupImage.php
Normal file
|
|
@ -0,0 +1,234 @@
|
|||
<?php
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* @ORM\Table
|
||||
* @ORM\Entity
|
||||
*/
|
||||
class FewoLodgingGroupImage
|
||||
{
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="IDENTITY")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="full_file_name", type="string", length=255, nullable=false)
|
||||
* @Assert\Image(maxSize="15000000", mimeTypes={"image/jpeg", "image/png"})
|
||||
*/
|
||||
private $file;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="file_name", type="string", length=255, nullable=false)
|
||||
* @Assert\NotBlank
|
||||
*/
|
||||
private $fileName;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="comp", type="string", length=4, nullable=true)
|
||||
* @Assert\NotBlank
|
||||
*/
|
||||
private $comp;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="pos", type="integer", nullable=false)
|
||||
* @Assert\NotBlank
|
||||
*/
|
||||
private $pos;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="description", type="string", length=255, nullable=true)
|
||||
*/
|
||||
private $description;
|
||||
|
||||
/**
|
||||
* @var \AppBundle\Entity\FewoLodgingGroup
|
||||
*
|
||||
* @ORM\ManyToOne(targetEntity="FewoLodgingGroup", inversedBy="images")
|
||||
* @ORM\JoinColumns({
|
||||
* @ORM\JoinColumn(name="group_id", referencedColumnName="id", onDelete="SET NULL")
|
||||
* })
|
||||
*/
|
||||
private $lodgingGroup;
|
||||
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set file
|
||||
*
|
||||
* @param string $file
|
||||
*
|
||||
* @return FewoLodgingGroupImage
|
||||
*/
|
||||
public function setFile($file)
|
||||
{
|
||||
$this->file = $file;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get file
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFile()
|
||||
{
|
||||
return $this->file;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set description
|
||||
*
|
||||
* @param string $description
|
||||
*
|
||||
* @return FewoLodgingGroupImage
|
||||
*/
|
||||
public function setDescription($description)
|
||||
{
|
||||
$this->description = $description;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get description
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDescription()
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set comp
|
||||
*
|
||||
* @param string $comp
|
||||
*
|
||||
* @return FewoLodgingGroupImage
|
||||
*/
|
||||
public function setComp($comp)
|
||||
{
|
||||
$this->comp = $comp;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get comp
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getComp()
|
||||
{
|
||||
return $this->comp;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set pos
|
||||
*
|
||||
* @param string $pos
|
||||
*
|
||||
* @return FewoLodgingGroupImage
|
||||
*/
|
||||
public function setPos($pos)
|
||||
{
|
||||
$this->pos = $pos;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get pos
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPos()
|
||||
{
|
||||
return $this->pos;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set lodgingGroup
|
||||
*
|
||||
* @param \AppBundle\Entity\FewoLodgingGroup $lodgingGroup
|
||||
*
|
||||
* @return FewoLodgingGroupImage
|
||||
*/
|
||||
public function setLodgingGroup(\AppBundle\Entity\FewoLodgingGroup $lodgingGroup = null)
|
||||
{
|
||||
$this->lodgingGroup = $lodgingGroup;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get lodgingGroup
|
||||
*
|
||||
* @return \AppBundle\Entity\FewoLodgingGroup
|
||||
*/
|
||||
public function getLodgingGroup()
|
||||
{
|
||||
return $this->lodgingGroup;
|
||||
}
|
||||
|
||||
function __toString()
|
||||
{
|
||||
return $this->file;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set fileName
|
||||
*
|
||||
* @param string $fileName
|
||||
*
|
||||
* @return FewoLodgingGroupImage
|
||||
*/
|
||||
public function setFileName($fileName)
|
||||
{
|
||||
$this->fileName = $fileName;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get fileName
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFileName()
|
||||
{
|
||||
return $this->fileName;
|
||||
}
|
||||
}
|
||||
200
src/AppBundle/Entity/FewoLodgingImage.php
Normal file
200
src/AppBundle/Entity/FewoLodgingImage.php
Normal file
|
|
@ -0,0 +1,200 @@
|
|||
<?php
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* @ORM\Table
|
||||
* @ORM\Entity
|
||||
*/
|
||||
class FewoLodgingImage
|
||||
{
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="IDENTITY")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="full_file_name", type="string", length=255, nullable=false)
|
||||
* @Assert\Image(maxSize="15000000", mimeTypes={"image/jpeg", "image/png"})
|
||||
*/
|
||||
private $file;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="file_name", type="string", length=255, nullable=false)
|
||||
* @Assert\NotBlank
|
||||
*/
|
||||
private $fileName;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="pos", type="integer", nullable=false)
|
||||
* @Assert\NotBlank
|
||||
*/
|
||||
private $pos;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="description", type="string", length=255, nullable=true)
|
||||
*/
|
||||
private $description;
|
||||
|
||||
/**
|
||||
* @var \AppBundle\Entity\FewoLodging
|
||||
*
|
||||
* @ORM\ManyToOne(targetEntity="FewoLodging", inversedBy="images")
|
||||
* @ORM\JoinColumns({
|
||||
* @ORM\JoinColumn(name="lodging_id", referencedColumnName="id", onDelete="SET NULL")
|
||||
* })
|
||||
*/
|
||||
private $lodging;
|
||||
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set file
|
||||
*
|
||||
* @param string $file
|
||||
*
|
||||
* @return FewoLodgingImage
|
||||
*/
|
||||
public function setFile($file)
|
||||
{
|
||||
$this->file = $file;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get file
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFile()
|
||||
{
|
||||
return $this->file;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set pos
|
||||
*
|
||||
* @param string $pos
|
||||
*
|
||||
* @return FewoLodgingImage
|
||||
*/
|
||||
public function setPos($pos)
|
||||
{
|
||||
$this->pos = $pos;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get pos
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPos()
|
||||
{
|
||||
return $this->pos;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set description
|
||||
*
|
||||
* @param string $description
|
||||
*
|
||||
* @return FewoLodgingImage
|
||||
*/
|
||||
public function setDescription($description)
|
||||
{
|
||||
$this->description = $description;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get description
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDescription()
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set lodging
|
||||
*
|
||||
* @param \AppBundle\Entity\FewoLodging $lodging
|
||||
*
|
||||
* @return FewoLodgingImage
|
||||
*/
|
||||
public function setLodging(\AppBundle\Entity\FewoLodging $lodging = null)
|
||||
{
|
||||
$this->lodging = $lodging;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get lodging
|
||||
*
|
||||
* @return \AppBundle\Entity\FewoLodging
|
||||
*/
|
||||
public function getLodging()
|
||||
{
|
||||
return $this->lodging;
|
||||
}
|
||||
|
||||
function __toString()
|
||||
{
|
||||
return $this->file;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set fileName
|
||||
*
|
||||
* @param string $fileName
|
||||
*
|
||||
* @return FewoLodgingImage
|
||||
*/
|
||||
public function setFileName($fileName)
|
||||
{
|
||||
$this->fileName = $fileName;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get fileName
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFileName()
|
||||
{
|
||||
return $this->fileName;
|
||||
}
|
||||
}
|
||||
47
src/AppBundle/Entity/FewoLodgingRepository.php
Normal file
47
src/AppBundle/Entity/FewoLodgingRepository.php
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
<?php
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
use Doctrine\ORM\Query\Expr\OrderBy;
|
||||
|
||||
/**
|
||||
* FewoLodgingRepository
|
||||
*
|
||||
* This class was generated by the Doctrine ORM. Add your own custom
|
||||
* repository methods below.
|
||||
*/
|
||||
class FewoLodgingRepository extends \Doctrine\ORM\EntityRepository
|
||||
{
|
||||
/**
|
||||
* @param FewoLodging $lodging
|
||||
*
|
||||
* @return FewoSeason|null
|
||||
*/
|
||||
public function findLatestSeasonEndForLodging($lodging)
|
||||
{
|
||||
$qb = $this->getEntityManager()->createQueryBuilder();
|
||||
$qb->select('s');
|
||||
$qb->from('AppBundle:FewoSeason', 's');
|
||||
$qb->innerJoin('s.prices', 'p');
|
||||
$qb->where($qb->expr()->eq('p.lodging', $lodging->getId()));
|
||||
$qb->addOrderBy('s.toDate', 'DESC');
|
||||
$qb->setMaxResults(1);
|
||||
return $qb->getQuery()->getOneOrNullResult();
|
||||
}
|
||||
|
||||
|
||||
public function findSeasonForLodgingBy($lodging, $fromDate)
|
||||
{
|
||||
$qb = $this->getEntityManager()->createQueryBuilder();
|
||||
$qb->select('s');
|
||||
$qb->from('AppBundle:FewoSeason', 's');
|
||||
$qb->innerJoin('s.prices', 'p');
|
||||
$qb->where($qb->expr()->eq('p.lodging', $lodging->getId()));
|
||||
$qb->andWhere('s.fromDate <= :fromDate');
|
||||
$qb->andWhere('s.toDate >= :fromDate');
|
||||
$qb->setParameter('fromDate', $fromDate);
|
||||
$qb->addOrderBy('s.fromDate', 'DESC');
|
||||
$qb->setMaxResults(1);
|
||||
return $qb->getQuery()->getOneOrNullResult();
|
||||
}
|
||||
|
||||
}
|
||||
70
src/AppBundle/Entity/FewoLodgingType.php
Normal file
70
src/AppBundle/Entity/FewoLodgingType.php
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
<?php
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* @ORM\Table
|
||||
* @ORM\Entity
|
||||
*/
|
||||
class FewoLodgingType
|
||||
{
|
||||
/**
|
||||
* @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=true)
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set name
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return FewoLodgingType
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
function __toString()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
163
src/AppBundle/Entity/FewoPrice.php
Normal file
163
src/AppBundle/Entity/FewoPrice.php
Normal file
|
|
@ -0,0 +1,163 @@
|
|||
<?php
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* @ORM\Table
|
||||
* @ORM\Entity
|
||||
*/
|
||||
class FewoPrice
|
||||
{
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="IDENTITY")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @var \AppBundle\Entity\FewoLodging
|
||||
*
|
||||
* @ORM\ManyToOne(targetEntity="FewoLodging", inversedBy="prices")
|
||||
* @ORM\JoinColumns({
|
||||
* @ORM\JoinColumn(name="lodging_id", referencedColumnName="id")
|
||||
* })
|
||||
*/
|
||||
private $lodging;
|
||||
|
||||
/**
|
||||
* @var \AppBundle\Entity\FewoSeason
|
||||
*
|
||||
* @ORM\ManyToOne(targetEntity="FewoSeason", inversedBy="prices")
|
||||
* @ORM\JoinColumns({
|
||||
* @ORM\JoinColumn(name="season_id", referencedColumnName="id", onDelete="SET NULL")
|
||||
* })
|
||||
*/
|
||||
private $season;
|
||||
|
||||
/**
|
||||
* @var float
|
||||
*
|
||||
* @ORM\Column(name="per_night", type="float", scale=2, nullable=false)
|
||||
*/
|
||||
private $perNight;
|
||||
|
||||
/**
|
||||
* @var float
|
||||
*
|
||||
* @ORM\Column(name="flat_price", type="float", scale=2, nullable=false)
|
||||
*/
|
||||
private $flatPrice;
|
||||
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set perNight
|
||||
*
|
||||
* @param float $perNight
|
||||
*
|
||||
* @return FewoPrice
|
||||
*/
|
||||
public function setPerNight($perNight)
|
||||
{
|
||||
$this->perNight = $perNight;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get perNight
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function getPerNight()
|
||||
{
|
||||
return $this->perNight;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set flatPrice
|
||||
*
|
||||
* @param float $flatPrice
|
||||
*
|
||||
* @return FewoPrice
|
||||
*/
|
||||
public function setFlatPrice($flatPrice)
|
||||
{
|
||||
$this->flatPrice = $flatPrice;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get flatPrice
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function getFlatPrice()
|
||||
{
|
||||
return $this->flatPrice;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set lodging
|
||||
*
|
||||
* @param \AppBundle\Entity\FewoLodging $lodging
|
||||
*
|
||||
* @return FewoPrice
|
||||
*/
|
||||
public function setLodging(\AppBundle\Entity\FewoLodging $lodging = null)
|
||||
{
|
||||
$this->lodging = $lodging;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get lodging
|
||||
*
|
||||
* @return \AppBundle\Entity\FewoLodging
|
||||
*/
|
||||
public function getLodging()
|
||||
{
|
||||
return $this->lodging;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set season
|
||||
*
|
||||
* @param \AppBundle\Entity\FewoSeason $season
|
||||
*
|
||||
* @return FewoPrice
|
||||
*/
|
||||
public function setSeason(\AppBundle\Entity\FewoSeason $season = null)
|
||||
{
|
||||
$this->season = $season;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get season
|
||||
*
|
||||
* @return \AppBundle\Entity\FewoSeason
|
||||
*/
|
||||
public function getSeason()
|
||||
{
|
||||
return $this->season;
|
||||
}
|
||||
}
|
||||
204
src/AppBundle/Entity/FewoReservation.php
Normal file
204
src/AppBundle/Entity/FewoReservation.php
Normal file
|
|
@ -0,0 +1,204 @@
|
|||
<?php
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
use AppBundle\Validator\Constraints as AppBundleAssert;
|
||||
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* @ORM\Table
|
||||
* @ORM\Entity
|
||||
* @AppBundleAssert\FewoReservation
|
||||
*/
|
||||
class FewoReservation
|
||||
{
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="IDENTITY")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @var \AppBundle\Entity\FewoLodging
|
||||
*
|
||||
* @ORM\ManyToOne(targetEntity="FewoLodging", inversedBy="reservations")
|
||||
* @ORM\JoinColumns({
|
||||
* @ORM\JoinColumn(name="lodging_id", referencedColumnName="id", onDelete="SET NULL")
|
||||
* })
|
||||
*/
|
||||
private $lodging;
|
||||
|
||||
/**
|
||||
* @var \DateTime
|
||||
*
|
||||
* @ORM\Column(name="from_date", type="date", nullable=false)
|
||||
*/
|
||||
private $fromDate;
|
||||
|
||||
/**
|
||||
* @var \DateTime
|
||||
*
|
||||
* @ORM\Column(name="to_date", type="date", nullable=false)
|
||||
*/
|
||||
private $toDate;
|
||||
|
||||
// belegt, nicht verfügbar
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* @ORM\Column(name="status", type="integer", nullable=false)
|
||||
*/
|
||||
private $status;
|
||||
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* @ORM\Column(name="type", type="integer", nullable=true)
|
||||
*/
|
||||
private $type;
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set fromDate
|
||||
*
|
||||
* @param \DateTime $fromDate
|
||||
*
|
||||
* @return FewoReservation
|
||||
*/
|
||||
public function setFromDate($fromDate)
|
||||
{
|
||||
$this->fromDate = $fromDate;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get fromDate
|
||||
*
|
||||
* @return \DateTime
|
||||
*/
|
||||
public function getFromDate()
|
||||
{
|
||||
return $this->fromDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set toDate
|
||||
*
|
||||
* @param \DateTime $toDate
|
||||
*
|
||||
* @return FewoReservation
|
||||
*/
|
||||
public function setToDate($toDate)
|
||||
{
|
||||
$this->toDate = $toDate;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get toDate
|
||||
*
|
||||
* @return \DateTime
|
||||
*/
|
||||
public function getToDate()
|
||||
{
|
||||
return $this->toDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set status
|
||||
*
|
||||
* @param integer $status
|
||||
*
|
||||
* @return FewoReservation
|
||||
*/
|
||||
public function setStatus($status)
|
||||
{
|
||||
$this->status = $status;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get status
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getStatus()
|
||||
{
|
||||
return $this->status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set lodging
|
||||
*
|
||||
* @param \AppBundle\Entity\FewoLodging $lodging
|
||||
*
|
||||
* @return FewoReservation
|
||||
*/
|
||||
public function setLodging(\AppBundle\Entity\FewoLodging $lodging = null)
|
||||
{
|
||||
$this->lodging = $lodging;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get lodging
|
||||
*
|
||||
* @return \AppBundle\Entity\FewoLodging
|
||||
*/
|
||||
public function getLodging()
|
||||
{
|
||||
return $this->lodging;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set type
|
||||
*
|
||||
* @param integer $type
|
||||
*
|
||||
* @return FewoReservation
|
||||
*/
|
||||
public function setType($type)
|
||||
{
|
||||
$this->type = $type;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get type
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Assert\Callback
|
||||
*/
|
||||
public function validate(ExecutionContextInterface $context, $payload)
|
||||
{
|
||||
//$context->
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
277
src/AppBundle/Entity/FewoSeason.php
Normal file
277
src/AppBundle/Entity/FewoSeason.php
Normal file
|
|
@ -0,0 +1,277 @@
|
|||
<?php
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
use Symfony\Component\Validator\Constraints\Date;
|
||||
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* @ORM\Table
|
||||
* @ORM\Entity
|
||||
*/
|
||||
class FewoSeason
|
||||
{
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="IDENTITY")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
// es gab hier lodgings, wird aber über prices geholt
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="name", type="string", length=255, nullable=false)
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* @var \AppBundle\Entity\FewoPrice
|
||||
*
|
||||
* @ORM\OneToMany(targetEntity="FewoPrice", mappedBy="season", cascade={"persist", "remove"})
|
||||
*/
|
||||
private $prices;
|
||||
|
||||
/**
|
||||
* @var \DateTime
|
||||
*
|
||||
* @ORM\Column(name="from_date", type="date", nullable=false)
|
||||
*/
|
||||
private $fromDate;
|
||||
|
||||
/**
|
||||
* @var \DateTime
|
||||
*
|
||||
* @ORM\Column(name="to_date", type="date", nullable=false)
|
||||
*/
|
||||
private $toDate;
|
||||
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* @ORM\Column(name="minimum_stay", type="integer", nullable=false)
|
||||
*/
|
||||
private $minimumStay;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="description", type="text", nullable=true)
|
||||
*/
|
||||
private $description;
|
||||
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* @ORM\Column(name="only_weekday", type="integer", nullable=true)
|
||||
*/
|
||||
private $onlyWeekday;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->prices = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set fromDate
|
||||
*
|
||||
* @param \DateTime $fromDate
|
||||
*
|
||||
* @return FewoSeason
|
||||
*/
|
||||
public function setFromDate($fromDate)
|
||||
{
|
||||
$this->fromDate = $fromDate;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get fromDate
|
||||
*
|
||||
* @return \DateTime
|
||||
*/
|
||||
public function getFromDate()
|
||||
{
|
||||
return $this->fromDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set toDate
|
||||
*
|
||||
* @param \DateTime $toDate
|
||||
*
|
||||
* @return FewoSeason
|
||||
*/
|
||||
public function setToDate($toDate)
|
||||
{
|
||||
$this->toDate = $toDate;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get toDate
|
||||
*
|
||||
* @return \DateTime
|
||||
*/
|
||||
public function getToDate()
|
||||
{
|
||||
return $this->toDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set minimumStay
|
||||
*
|
||||
* @param integer $minimumStay
|
||||
*
|
||||
* @return FewoSeason
|
||||
*/
|
||||
public function setMinimumStay($minimumStay)
|
||||
{
|
||||
$this->minimumStay = $minimumStay;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get minimumStay
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getMinimumStay()
|
||||
{
|
||||
return $this->minimumStay;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set description
|
||||
*
|
||||
* @param string $description
|
||||
*
|
||||
* @return FewoSeason
|
||||
*/
|
||||
public function setDescription($description)
|
||||
{
|
||||
$this->description = $description;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get description
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDescription()
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add price
|
||||
*
|
||||
* @param \AppBundle\Entity\FewoPrice $price
|
||||
*
|
||||
* @return FewoSeason
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set name
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return FewoSeason
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
function __toString()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set onlyWeekday
|
||||
*
|
||||
* @param integer $onlyWeekday
|
||||
*
|
||||
* @return FewoSeason
|
||||
*/
|
||||
public function setOnlyWeekday($onlyWeekday)
|
||||
{
|
||||
$this->onlyWeekday = $onlyWeekday;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get onlyWeekday
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getOnlyWeekday()
|
||||
{
|
||||
return $this->onlyWeekday;
|
||||
}
|
||||
}
|
||||
206
src/AppBundle/Entity/FlightPeriod.php
Normal file
206
src/AppBundle/Entity/FlightPeriod.php
Normal file
|
|
@ -0,0 +1,206 @@
|
|||
<?php
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* FlightPeriod
|
||||
*
|
||||
* @ORM\Table(name="flight_period", uniqueConstraints={@ORM\UniqueConstraint(name="UK_start_date_end_date_travel_arrival_point", columns={"start_date", "end_date", "travel_arrival_point_id"})}, indexes={@ORM\Index(name="FK_flight_period_travel_arrival_point", columns={"travel_arrival_point_id"})})
|
||||
* @ORM\Entity(repositoryClass="AppBundle\Entity\FlightPeriodRepository")
|
||||
*/
|
||||
class FlightPeriod
|
||||
{
|
||||
/**
|
||||
* @var \DateTime
|
||||
*
|
||||
* @ORM\Column(name="start_date", type="date", nullable=true)
|
||||
*/
|
||||
private $startDate;
|
||||
|
||||
/**
|
||||
* @var \DateTime
|
||||
*
|
||||
* @ORM\Column(name="end_date", type="date", nullable=true)
|
||||
*/
|
||||
private $endDate;
|
||||
|
||||
/**
|
||||
* @var float
|
||||
*
|
||||
* @ORM\Column(name="price", type="float", precision=10, scale=2, nullable=true)
|
||||
*/
|
||||
private $price;
|
||||
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="IDENTITY")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @var \AppBundle\Entity\TravelArrivalPoint
|
||||
*
|
||||
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\TravelArrivalPoint")
|
||||
* @ORM\JoinColumns({
|
||||
* @ORM\JoinColumn(name="travel_arrival_point_id", referencedColumnName="id")
|
||||
* })
|
||||
*/
|
||||
private $travelArrivalPoint;
|
||||
|
||||
/**
|
||||
* @ORM\OneToMany(targetEntity="AppBundle\Entity\TravelDeparturePoint", mappedBy="flightPeriod")
|
||||
*/
|
||||
private $departures;
|
||||
|
||||
/**
|
||||
* Set startDate
|
||||
*
|
||||
* @param \DateTime $startDate
|
||||
*
|
||||
* @return FlightPeriod
|
||||
*/
|
||||
public function setStartDate($startDate)
|
||||
{
|
||||
$this->startDate = $startDate;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get startDate
|
||||
*
|
||||
* @return \DateTime
|
||||
*/
|
||||
public function getStartDate()
|
||||
{
|
||||
return $this->startDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set endDate
|
||||
*
|
||||
* @param \DateTime $endDate
|
||||
*
|
||||
* @return FlightPeriod
|
||||
*/
|
||||
public function setEndDate($endDate)
|
||||
{
|
||||
$this->endDate = $endDate;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get endDate
|
||||
*
|
||||
* @return \DateTime
|
||||
*/
|
||||
public function getEndDate()
|
||||
{
|
||||
return $this->endDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set price
|
||||
*
|
||||
* @param float $price
|
||||
*
|
||||
* @return FlightPeriod
|
||||
*/
|
||||
public function setPrice($price)
|
||||
{
|
||||
$this->price = $price;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get price
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function getPrice()
|
||||
{
|
||||
return $this->price;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set travelArrivalPoint
|
||||
*
|
||||
* @param \AppBundle\Entity\TravelArrivalPoint $travelArrivalPoint
|
||||
*
|
||||
* @return FlightPeriod
|
||||
*/
|
||||
public function setTravelArrivalPoint(\AppBundle\Entity\TravelArrivalPoint $travelArrivalPoint = null)
|
||||
{
|
||||
$this->travelArrivalPoint = $travelArrivalPoint;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get travelArrivalPoint
|
||||
*
|
||||
* @return \AppBundle\Entity\TravelArrivalPoint
|
||||
*/
|
||||
public function getTravelArrivalPoint()
|
||||
{
|
||||
return $this->travelArrivalPoint;
|
||||
}
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->departures = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add departure
|
||||
*
|
||||
* @param \AppBundle\Entity\TravelDeparturePoint $departure
|
||||
*
|
||||
* @return FlightPeriod
|
||||
*/
|
||||
public function addDeparture(\AppBundle\Entity\TravelDeparturePoint $departure)
|
||||
{
|
||||
$this->departures[] = $departure;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove departure
|
||||
*
|
||||
* @param \AppBundle\Entity\TravelDeparturePoint $departure
|
||||
*/
|
||||
public function removeDeparture(\AppBundle\Entity\TravelDeparturePoint $departure)
|
||||
{
|
||||
$this->departures->removeElement($departure);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get departures
|
||||
*
|
||||
* @return \Doctrine\Common\Collections\Collection
|
||||
*/
|
||||
public function getDepartures()
|
||||
{
|
||||
return $this->departures;
|
||||
}
|
||||
}
|
||||
59
src/AppBundle/Entity/FlightPeriodRepository.php
Normal file
59
src/AppBundle/Entity/FlightPeriodRepository.php
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
<?php
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
/**
|
||||
* FlightPeriodRepository
|
||||
*
|
||||
* This class was generated by the Doctrine ORM. Add your own custom
|
||||
* repository methods below.
|
||||
*/
|
||||
class FlightPeriodRepository extends \Doctrine\ORM\EntityRepository
|
||||
{
|
||||
public function getIndexedFlightPeriodsForTimePeriod($startDate, $endDate, $arrivalPointIds = null)
|
||||
{
|
||||
$qb = $this->getEntityManager()->createQueryBuilder();
|
||||
$qb
|
||||
->from('AppBundle:FlightPeriod', 'fp')
|
||||
->addSelect('fp')
|
||||
->leftJoin('fp.departures', 'fp_dep')
|
||||
->addSelect('fp_dep')
|
||||
;
|
||||
|
||||
if ($startDate !== null)
|
||||
{
|
||||
$qb->where('fp.startDate >= :startDate');
|
||||
$qb->setParameter('startDate', $startDate);
|
||||
}
|
||||
if ($endDate !== null)
|
||||
{
|
||||
$qb->andWhere('fp.endDate <= :endDate');
|
||||
$qb->setParameter('endDate', $endDate);
|
||||
}
|
||||
if (!empty($arrivalPointIds))
|
||||
{
|
||||
if (is_array($arrivalPointIds))
|
||||
{
|
||||
$qb->andWhere($qb->expr()->in('IDENTITY(fp.travelArrivalPoint)', $arrivalPointIds));
|
||||
}
|
||||
else
|
||||
{
|
||||
$qb->andWhere($qb->expr()->eq('IDENTITY(fp.travelArrivalPoint)', $arrivalPointIds));
|
||||
}
|
||||
}
|
||||
|
||||
$unindexedFlightPeriods = $qb->getQuery()->getResult();
|
||||
$ret = [];
|
||||
|
||||
// Index by CONCAT(start date, end date, arrival point id):
|
||||
/** @var FlightPeriod $flightPeriod */
|
||||
foreach ($unindexedFlightPeriods as $flightPeriod)
|
||||
{
|
||||
$ret[$flightPeriod->getStartDate()->format('Y-m-d') .
|
||||
$flightPeriod->getEndDate()->format('Y-m-d') .
|
||||
$flightPeriod->getTravelArrivalPoint()->getId()] = $flightPeriod;
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
97
src/AppBundle/Entity/Keyword.php
Normal file
97
src/AppBundle/Entity/Keyword.php
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
<?php
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* Keyword
|
||||
*
|
||||
* @ORM\Table(name="keyword", uniqueConstraints={@ORM\UniqueConstraint(name="value", columns={"value"})})
|
||||
* @ORM\Entity
|
||||
*/
|
||||
class Keyword
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="value", type="string", length=250, nullable=false)
|
||||
*/
|
||||
private $value;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="url", type="string", length=200, nullable=true)
|
||||
*/
|
||||
private $url;
|
||||
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="IDENTITY")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Set value
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return Keyword
|
||||
*/
|
||||
public function setValue($value)
|
||||
{
|
||||
$this->value = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get value
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getValue()
|
||||
{
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set url
|
||||
*
|
||||
* @param string $url
|
||||
*
|
||||
* @return Keyword
|
||||
*/
|
||||
public function setUrl($url)
|
||||
{
|
||||
$this->url = $url;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get url
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getUrl()
|
||||
{
|
||||
return $this->url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
}
|
||||
1411
src/AppBundle/Entity/Page.php
Normal file
1411
src/AppBundle/Entity/Page.php
Normal file
File diff suppressed because it is too large
Load diff
186
src/AppBundle/Entity/PageRepository.php
Normal file
186
src/AppBundle/Entity/PageRepository.php
Normal file
|
|
@ -0,0 +1,186 @@
|
|||
<?php
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
use Gedmo\Tree\Entity\Repository\NestedTreeRepository;
|
||||
use Doctrine\ORM\Query\Expr;
|
||||
|
||||
/**
|
||||
* PageRepository
|
||||
*
|
||||
* This class was generated by the Doctrine ORM. Add your own custom
|
||||
* repository methods below.
|
||||
*/
|
||||
class PageRepository extends NestedTreeRepository
|
||||
{
|
||||
/**
|
||||
* @param Page $page
|
||||
* @return Page[]|array
|
||||
*
|
||||
* @todo Optimize performance by adapting search algorithm's optimizations
|
||||
*/
|
||||
public function getChildrenWithTravelProgramsAndDates(Page $page)
|
||||
{
|
||||
$pages = $this->getChildrenQueryBuilder($page)
|
||||
->leftJoin('node.travelProgram', 'tp')
|
||||
->addSelect('tp')
|
||||
->andWhere('tp.status > 0')
|
||||
->andWhere('node.status > 0')
|
||||
->orderBy('node.order')
|
||||
->addOrderBy('tp.position')
|
||||
->addOrderBy('node.title')
|
||||
->getQuery()
|
||||
->execute();
|
||||
/** @var Page $childPage */
|
||||
foreach ($pages as &$childPage)
|
||||
{
|
||||
if ($childPage->getTravelProgram())
|
||||
{
|
||||
$this->getEntityManager()->getRepository('AppBundle:TravelPeriod')->getTrueTravelPeriods(
|
||||
$childPage->getTravelProgram());
|
||||
}
|
||||
}
|
||||
return $pages;
|
||||
}
|
||||
|
||||
public function findWithTravelProgramsOfCountry(TravelCountry $country)
|
||||
{
|
||||
return $this->createQueryBuilder('node')
|
||||
->innerJoin('node.travelProgram', 'tp')
|
||||
->innerJoin('tp.countries', 'c')
|
||||
->where('c.id = '. $country->getId())
|
||||
->andWhere('node.status = 1')
|
||||
->andWhere('tp.status = 1')
|
||||
->getQuery()
|
||||
->execute()
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Page[]
|
||||
*/
|
||||
public function findOffers()
|
||||
{
|
||||
$ret = [];
|
||||
$countries = $this->getEntityManager()->getRepository('AppBundle:TravelCountry')->findAll();
|
||||
foreach ($countries as $country)
|
||||
{
|
||||
$ret = array_merge($ret, $this->createQueryBuilder('node')
|
||||
->innerJoin('node.travelProgram', 'tp')
|
||||
->addSelect('tp')
|
||||
->innerJoin('tp.countries', 'c')
|
||||
->where('c.id = '. $country->getId())
|
||||
->andWhere('node.status = 1')
|
||||
->andWhere('tp.status = 1')
|
||||
->orderBy('node.order')
|
||||
->addOrderBy('tp.position')
|
||||
->addOrderBy('node.title')
|
||||
->setMaxResults(3)
|
||||
->getQuery()
|
||||
->execute()
|
||||
);
|
||||
}
|
||||
shuffle($ret);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public function findCountryPages()
|
||||
{
|
||||
return $this->createQueryBuilder('node')
|
||||
->innerJoin('node.country', 'country')
|
||||
->where('node.status > 0')
|
||||
->andWhere('node.template = \'overview\'')
|
||||
->andWhere('node.lvl = 0')
|
||||
->orderBy('node.lft,node.title')
|
||||
->getQuery()
|
||||
->execute()
|
||||
;
|
||||
}
|
||||
|
||||
public function findTopCountryNavPages()
|
||||
{
|
||||
return $this->createQueryBuilder('node')
|
||||
->innerJoin('node.country', 'country')
|
||||
->leftJoin('node.children', 'childPage', Expr\Join::WITH, 'childPage.status > 0')
|
||||
->addSelect('childPage')
|
||||
->where('node.status > 0')
|
||||
->andWhere('node.template = \'overview\'')
|
||||
->andWhere('node.lvl = 0')
|
||||
->andWhere('node.order > 0')
|
||||
->orderBy('node.order,node.title, childPage.lft, childPage.title')
|
||||
->getQuery()
|
||||
->execute()
|
||||
;
|
||||
}
|
||||
|
||||
public function findFeedbacks($rootPageId)
|
||||
{
|
||||
$qb = $this->createQueryBuilder('node');
|
||||
return $qb
|
||||
->where($qb->expr()->eq('node.parent', $rootPageId))
|
||||
->andWhere('node.showInNavi = 1')
|
||||
->andWhere('node.status = 1')
|
||||
->orderBy('node.order')
|
||||
->getQuery()
|
||||
->execute()
|
||||
;
|
||||
}
|
||||
|
||||
public function findParentsWithShowNav($rootPageId)
|
||||
{
|
||||
|
||||
$qb = $this->createQueryBuilder('node');
|
||||
$pages = $qb->innerJoin('node.travelProgram', 'tp')
|
||||
->addSelect('tp')
|
||||
->where($qb->expr()->eq('node.parent', $rootPageId))
|
||||
->andWhere('node.showInNavi = 1')
|
||||
->andWhere('node.status = 1')
|
||||
->andWhere('tp.status > 0')
|
||||
->orderBy('node.order')
|
||||
->getQuery()
|
||||
->execute()
|
||||
;
|
||||
|
||||
foreach ($pages as &$childPage)
|
||||
{
|
||||
if ($childPage->getTravelProgram())
|
||||
{
|
||||
// var_dump($childPage->getTravelProgram()->getId());
|
||||
// $this->getEntityManager()->getRepository('AppBundle:TravelPeriod')->getTrueTravelPeriods($childPage->getTravelProgram());
|
||||
}
|
||||
}
|
||||
return $pages;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Page $page
|
||||
*
|
||||
* @return Page[]|\Doctrine\Common\Collections\Collection
|
||||
*/
|
||||
public function getSiblings(Page $page)
|
||||
{
|
||||
$parent = $page->getParent();
|
||||
if (!$parent)
|
||||
{
|
||||
// On purpose, we don't treat root pages as if they were siblings
|
||||
return [];
|
||||
}
|
||||
$siblings = $parent->getChildren();
|
||||
foreach ($siblings as &$sibling)
|
||||
{
|
||||
$sibling->setParent($parent);
|
||||
}
|
||||
|
||||
// Da diese Methode nur für die Navigation verwendet wird, kann man hier vorfiltern
|
||||
$filteredSiblings = [];
|
||||
foreach ($siblings as &$sibling)
|
||||
{
|
||||
if($sibling->getStatus() == 1 && $sibling->getShowInNavi() == 1)
|
||||
{
|
||||
$filteredSiblings[] = $sibling;
|
||||
}
|
||||
}
|
||||
|
||||
return $filteredSiblings;
|
||||
}
|
||||
}
|
||||
96
src/AppBundle/Entity/Redirect.php
Normal file
96
src/AppBundle/Entity/Redirect.php
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
<?php
|
||||
/**
|
||||
* @author Ulrich Hecht <ulrich.hecht@hecht-software.de>
|
||||
* @date 02/15/2017
|
||||
*/
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* Redirect
|
||||
*
|
||||
* @ORM\Table(name="redirect")
|
||||
* @ORM\Entity(repositoryClass="AppBundle\Entity\RedirectRepository")
|
||||
*/
|
||||
class Redirect
|
||||
{
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="IDENTITY")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=200, nullable=false, unique=true)
|
||||
*/
|
||||
private $sourceUrlPath;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\Page")
|
||||
* @ORM\JoinColumn(name="page_id", referencedColumnName="id", nullable=false)
|
||||
*/
|
||||
protected $page;
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set sourceUrlPath
|
||||
*
|
||||
* @param string $sourceUrlPath
|
||||
*
|
||||
* @return Redirect
|
||||
*/
|
||||
public function setSourceUrlPath($sourceUrlPath)
|
||||
{
|
||||
$this->sourceUrlPath = $sourceUrlPath;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sourceUrlPath
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSourceUrlPath()
|
||||
{
|
||||
return $this->sourceUrlPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set page
|
||||
*
|
||||
* @param \AppBundle\Entity\Page $page
|
||||
*
|
||||
* @return Redirect
|
||||
*/
|
||||
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;
|
||||
}
|
||||
}
|
||||
13
src/AppBundle/Entity/RedirectRepository.php
Normal file
13
src/AppBundle/Entity/RedirectRepository.php
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
/**
|
||||
* RedirectRepository
|
||||
*
|
||||
* This class was generated by the Doctrine ORM. Add your own custom
|
||||
* repository methods below.
|
||||
*/
|
||||
class RedirectRepository extends \Doctrine\ORM\EntityRepository
|
||||
{
|
||||
}
|
||||
151
src/AppBundle/Entity/Room.php
Normal file
151
src/AppBundle/Entity/Room.php
Normal file
|
|
@ -0,0 +1,151 @@
|
|||
<?php
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
class Room
|
||||
{
|
||||
// von BookingRequest abgeguckt, brauch ich das überhaupt, wenn ich bei $type ein Assert habe?
|
||||
const SINGLE = 1;
|
||||
const DOUBLE = 2;
|
||||
const TRIPLE = 3;
|
||||
|
||||
const SINGLECHILD = 4;
|
||||
const DOUBLECHILD = 5;
|
||||
const TRIPLECHILD = 6;
|
||||
|
||||
/**
|
||||
* @Assert\NotNull
|
||||
* @Assert\Choice(choices={1,2,3})
|
||||
*/
|
||||
private $type;
|
||||
|
||||
private $child = false;
|
||||
|
||||
/**
|
||||
* @Assert\Valid
|
||||
*/
|
||||
private $travelers = [];
|
||||
|
||||
private $travelerCount;
|
||||
private $childrenCount;
|
||||
|
||||
public function __construct($type)
|
||||
{
|
||||
$child = 0;
|
||||
if($type == 4){
|
||||
$type = 1;
|
||||
$child = 1;
|
||||
$this->child = true;
|
||||
}
|
||||
if($type == 5){
|
||||
$type = 2;
|
||||
$child = 1;
|
||||
$this->child = true;
|
||||
}
|
||||
if($type == 6){
|
||||
$type = 3;
|
||||
$child = 1;
|
||||
$this->child = true;
|
||||
}
|
||||
$this->type = $type;
|
||||
|
||||
for($i = 0; $i < $this->type; $i++)
|
||||
{
|
||||
$this->travelers[] = new Traveler();
|
||||
}
|
||||
|
||||
for($i = 0; $i < $child; $i++)
|
||||
{
|
||||
$temp = new Traveler();
|
||||
$temp->setChild(true);
|
||||
$this->travelers[] = $temp;
|
||||
$this->childrenCount++;
|
||||
}
|
||||
|
||||
$this->travelerCount = $type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $type
|
||||
*/
|
||||
public function setType($type)
|
||||
{
|
||||
$this->type = $type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getChild()
|
||||
{
|
||||
return $this->child;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $child
|
||||
*/
|
||||
public function setChild($child)
|
||||
{
|
||||
$this->child = $child;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Traveler[]
|
||||
*/
|
||||
public function getTravelers()
|
||||
{
|
||||
return $this->travelers;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Traveler[] $travelers
|
||||
*/
|
||||
public function setTravelers($travelers)
|
||||
{
|
||||
$this->travelers = $travelers;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getTravelerCount()
|
||||
{
|
||||
return $this->travelerCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $travelerCount
|
||||
*/
|
||||
public function setTravelerCount($travelerCount)
|
||||
{
|
||||
$this->travelerCount = $travelerCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getChildrenCount()
|
||||
{
|
||||
return $this->childrenCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $childrenCount
|
||||
*/
|
||||
public function setChildrenCount($childrenCount)
|
||||
{
|
||||
$this->childrenCount = $childrenCount;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
61
src/AppBundle/Entity/SearchFewoRequest.php
Normal file
61
src/AppBundle/Entity/SearchFewoRequest.php
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
<?php
|
||||
/**
|
||||
* @author Ulrich Hecht <ulrich.hecht@hecht-software.de>
|
||||
* @date 12/08/2016
|
||||
*/
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
|
||||
class SearchFewoRequest
|
||||
{
|
||||
private $from;
|
||||
private $to;
|
||||
|
||||
/**
|
||||
* SearchFewoRequest constructor.
|
||||
*
|
||||
* @param $from
|
||||
* @param $to
|
||||
*/
|
||||
public function __construct($from = null, $to = null)
|
||||
{
|
||||
$this->from = $from;
|
||||
$this->to = $to;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getFrom()
|
||||
{
|
||||
return $this->from;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getTo()
|
||||
{
|
||||
return $this->to;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function setFrom($value)
|
||||
{
|
||||
return $this->from = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function setTo($value)
|
||||
{
|
||||
return $this->to = $value;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
237
src/AppBundle/Entity/SidebarWidget.php
Normal file
237
src/AppBundle/Entity/SidebarWidget.php
Normal file
|
|
@ -0,0 +1,237 @@
|
|||
<?php
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* SidebarWidget
|
||||
*
|
||||
* @ORM\Table(name="sidebar_widgets")
|
||||
* @ORM\Entity(repositoryClass="AppBundle\Entity\SidebarWidgetRepository")
|
||||
*/
|
||||
class SidebarWidget
|
||||
{
|
||||
/**
|
||||
* @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=true)
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="component", type="string", length=255, nullable=true)
|
||||
*/
|
||||
private $component;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="html", type="text", length=65535, nullable=true)
|
||||
*/
|
||||
private $html;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="show_at", type="text", length=65535, nullable=true)
|
||||
*/
|
||||
private $showAt;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*
|
||||
* @ORM\Column(name="pos", type="integer", nullable=true)
|
||||
*/
|
||||
private $pos;
|
||||
|
||||
/**
|
||||
* @var boolean
|
||||
*
|
||||
* @ORM\Column(name="active", type="boolean", nullable=false)
|
||||
*/
|
||||
private $active;
|
||||
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set name
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return SidebarWidget
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set component
|
||||
*
|
||||
* @param string $component
|
||||
*
|
||||
* @return SidebarWidget
|
||||
*/
|
||||
public function setComponent($component)
|
||||
{
|
||||
$this->component = $component;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get component
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getComponent()
|
||||
{
|
||||
return $this->component;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set html
|
||||
*
|
||||
* @param string $html
|
||||
*
|
||||
* @return SidebarWidget
|
||||
*/
|
||||
public function setHtml($html)
|
||||
{
|
||||
$this->html = $html;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get html
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getHtml()
|
||||
{
|
||||
return $this->html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set showAt
|
||||
*
|
||||
* @param string $showAt
|
||||
*
|
||||
* @return SidebarWidget
|
||||
*/
|
||||
public function setShowAt($showAt)
|
||||
{
|
||||
$this->showAt = $showAt;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get showAt
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getShowAt()
|
||||
{
|
||||
return $this->showAt == null ? null : json_decode($this->showAt);
|
||||
|
||||
//return $this->showAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $weekday Weekday as returned by date format 'w'
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getIsShowAt($site)
|
||||
{
|
||||
if ($this->showAt == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return in_array($site, json_decode($this->showAt));
|
||||
}
|
||||
|
||||
/**
|
||||
* Set pos
|
||||
*
|
||||
* @param integer $pos
|
||||
*
|
||||
* @return SidebarWidget
|
||||
*/
|
||||
public function setPos($pos)
|
||||
{
|
||||
$this->pos = $pos;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get pos
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getPos()
|
||||
{
|
||||
return $this->pos;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set active
|
||||
*
|
||||
* @param boolean $active
|
||||
*
|
||||
* @return SidebarWidget
|
||||
*/
|
||||
public function setActive($active)
|
||||
{
|
||||
$this->active = $active;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get active
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getActive()
|
||||
{
|
||||
return $this->active;
|
||||
}
|
||||
}
|
||||
|
||||
30
src/AppBundle/Entity/SidebarWidgetRepository.php
Normal file
30
src/AppBundle/Entity/SidebarWidgetRepository.php
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
/**
|
||||
* SidebarWidgetRepository
|
||||
*
|
||||
* This class was generated by the Doctrine ORM. Add your own custom
|
||||
* repository methods below.
|
||||
*/
|
||||
class SidebarWidgetRepository extends \Doctrine\ORM\EntityRepository
|
||||
{
|
||||
|
||||
public function findWidgetsBy($site)
|
||||
{
|
||||
$qb = $this->createQueryBuilder('sidebar_widget');
|
||||
$qb->where('sidebar_widget.active = 1')
|
||||
->addOrderBy('sidebar_widget.pos', 'ASC');
|
||||
$results = $qb->getQuery()->getResult();
|
||||
|
||||
$ret = [];
|
||||
foreach ($results as $result)
|
||||
{
|
||||
if($result->getIsShowAt($site)){
|
||||
$ret[] = $result;
|
||||
}
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
306
src/AppBundle/Entity/SunstarTravelProgram.php
Normal file
306
src/AppBundle/Entity/SunstarTravelProgram.php
Normal file
|
|
@ -0,0 +1,306 @@
|
|||
<?php
|
||||
/**
|
||||
* @author Ulrich Hecht <ulrich.hecht@hecht-software.de>
|
||||
* @date 03/24/2017
|
||||
*/
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* Redirect
|
||||
*
|
||||
* @ORM\Table
|
||||
* @ORM\Entity
|
||||
*/
|
||||
class SunstarTravelProgram
|
||||
{
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="IDENTITY")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=255, nullable=true)
|
||||
*/
|
||||
protected $title;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", nullable=true)
|
||||
*/
|
||||
protected $description;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=255, nullable=true)
|
||||
*/
|
||||
protected $destination;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=200, nullable=true)
|
||||
*/
|
||||
protected $url;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=200, nullable=true)
|
||||
*/
|
||||
protected $imageUrl;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=20, nullable=true)
|
||||
*/
|
||||
protected $duration;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="float", nullable=true)
|
||||
*/
|
||||
protected $minimumPrice;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="integer", nullable=true)
|
||||
*/
|
||||
protected $minimumAge;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="integer", nullable=true)
|
||||
*/
|
||||
protected $maximumAge;
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
*/
|
||||
public function setId(int $id)
|
||||
{
|
||||
$this->id = $id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set title
|
||||
*
|
||||
* @param string $title
|
||||
*
|
||||
* @return SunstarTravelProgram
|
||||
*/
|
||||
public function setTitle($title)
|
||||
{
|
||||
$this->title = $title;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get title
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle()
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set description
|
||||
*
|
||||
* @param string $description
|
||||
*
|
||||
* @return SunstarTravelProgram
|
||||
*/
|
||||
public function setDescription($description)
|
||||
{
|
||||
$this->description = $description;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get description
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDescription()
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set destination
|
||||
*
|
||||
* @param string $destination
|
||||
*
|
||||
* @return SunstarTravelProgram
|
||||
*/
|
||||
public function setDestination($destination)
|
||||
{
|
||||
$this->destination = $destination;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get destination
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDestination()
|
||||
{
|
||||
return $this->destination;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set url
|
||||
*
|
||||
* @param string $url
|
||||
*
|
||||
* @return SunstarTravelProgram
|
||||
*/
|
||||
public function setUrl($url)
|
||||
{
|
||||
$this->url = $url;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get url
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getUrl()
|
||||
{
|
||||
return $this->url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set imageUrl
|
||||
*
|
||||
* @param string $imageUrl
|
||||
*
|
||||
* @return SunstarTravelProgram
|
||||
*/
|
||||
public function setImageUrl($imageUrl)
|
||||
{
|
||||
$this->imageUrl = $imageUrl;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get imageUrl
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getImageUrl()
|
||||
{
|
||||
return $this->imageUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set duration
|
||||
*
|
||||
* @param integer $duration
|
||||
*
|
||||
* @return SunstarTravelProgram
|
||||
*/
|
||||
public function setDuration($duration)
|
||||
{
|
||||
$this->duration = $duration;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get duration
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getDuration()
|
||||
{
|
||||
return $this->duration;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set minimumPrice
|
||||
*
|
||||
* @param float $minimumPrice
|
||||
*
|
||||
* @return SunstarTravelProgram
|
||||
*/
|
||||
public function setMinimumPrice($minimumPrice)
|
||||
{
|
||||
$this->minimumPrice = $minimumPrice;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get minimumPrice
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function getMinimumPrice()
|
||||
{
|
||||
return $this->minimumPrice;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set minimumAge
|
||||
*
|
||||
* @param integer $minimumAge
|
||||
*
|
||||
* @return SunstarTravelProgram
|
||||
*/
|
||||
public function setMinimumAge($minimumAge)
|
||||
{
|
||||
$this->minimumAge = $minimumAge;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get minimumAge
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getMinimumAge()
|
||||
{
|
||||
return $this->minimumAge;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set maximumAge
|
||||
*
|
||||
* @param integer $maximumAge
|
||||
*
|
||||
* @return SunstarTravelProgram
|
||||
*/
|
||||
public function setMaximumAge($maximumAge)
|
||||
{
|
||||
$this->maximumAge = $maximumAge;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get maximumAge
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getMaximumAge()
|
||||
{
|
||||
return $this->maximumAge;
|
||||
}
|
||||
}
|
||||
218
src/AppBundle/Entity/TestTree.php
Normal file
218
src/AppBundle/Entity/TestTree.php
Normal file
|
|
@ -0,0 +1,218 @@
|
|||
<?php
|
||||
/**
|
||||
* @author Ulrich Hecht <ulrich.hecht@hecht-software.de>
|
||||
* @date 12/03/2016
|
||||
*/
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
use Gedmo\Mapping\Annotation as Gedmo;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* @ORM\Table(name="test_tree")
|
||||
* @ORM\Entity(repositoryClass="Gedmo\Tree\Entity\Repository\NestedTreeRepository")
|
||||
* @Gedmo\Tree(type="nested")
|
||||
*/
|
||||
class TestTree
|
||||
{
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="IDENTITY")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @Gedmo\TreeLeft
|
||||
* @ORM\Column(type="integer", nullable=true)
|
||||
*/
|
||||
protected $lft;
|
||||
|
||||
/**
|
||||
* @Gedmo\TreeLevel()
|
||||
* @ORM\Column(type="integer", nullable=true)
|
||||
*/
|
||||
protected $lvl;
|
||||
|
||||
/**
|
||||
* @Gedmo\TreeRight
|
||||
* @ORM\Column(type="integer", nullable=true)
|
||||
*/
|
||||
protected $rgt;
|
||||
|
||||
/**
|
||||
* @Gedmo\TreeRoot
|
||||
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\TestTree")
|
||||
* @ORM\JoinColumn(name="tree_root", referencedColumnName="id", onDelete="CASCADE")
|
||||
*/
|
||||
private $root;
|
||||
|
||||
/**
|
||||
* @Gedmo\TreeParent
|
||||
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\TestTree", inversedBy="children")
|
||||
* @ORM\JoinColumn(name="parent_id", referencedColumnName="id", onDelete="CASCADE")
|
||||
*/
|
||||
private $parent;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=255, nullable=true)
|
||||
*/
|
||||
protected $value;
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set lft
|
||||
*
|
||||
* @param integer $lft
|
||||
*
|
||||
* @return TestTree
|
||||
*/
|
||||
public function setLft($lft)
|
||||
{
|
||||
$this->lft = $lft;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get lft
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getLft()
|
||||
{
|
||||
return $this->lft;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set lvl
|
||||
*
|
||||
* @param integer $lvl
|
||||
*
|
||||
* @return TestTree
|
||||
*/
|
||||
public function setLvl($lvl)
|
||||
{
|
||||
$this->lvl = $lvl;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get lvl
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getLvl()
|
||||
{
|
||||
return $this->lvl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set rgt
|
||||
*
|
||||
* @param integer $rgt
|
||||
*
|
||||
* @return TestTree
|
||||
*/
|
||||
public function setRgt($rgt)
|
||||
{
|
||||
$this->rgt = $rgt;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get rgt
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getRgt()
|
||||
{
|
||||
return $this->rgt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set root
|
||||
*
|
||||
* @param \AppBundle\Entity\TestTree $root
|
||||
*
|
||||
* @return TestTree
|
||||
*/
|
||||
public function setRoot(\AppBundle\Entity\TestTree $root = null)
|
||||
{
|
||||
$this->root = $root;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get root
|
||||
*
|
||||
* @return \AppBundle\Entity\TestTree
|
||||
*/
|
||||
public function getRoot()
|
||||
{
|
||||
return $this->root;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set parent
|
||||
*
|
||||
* @param \AppBundle\Entity\TestTree $parent
|
||||
*
|
||||
* @return TestTree
|
||||
*/
|
||||
public function setParent(\AppBundle\Entity\TestTree $parent = null)
|
||||
{
|
||||
$this->parent = $parent;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get parent
|
||||
*
|
||||
* @return \AppBundle\Entity\TestTree
|
||||
*/
|
||||
public function getParent()
|
||||
{
|
||||
return $this->parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set value
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return TestTree
|
||||
*/
|
||||
public function setValue($value)
|
||||
{
|
||||
$this->value = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get value
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getValue()
|
||||
{
|
||||
return $this->value;
|
||||
}
|
||||
}
|
||||
188
src/AppBundle/Entity/TravelArrivalPoint.php
Normal file
188
src/AppBundle/Entity/TravelArrivalPoint.php
Normal file
|
|
@ -0,0 +1,188 @@
|
|||
<?php
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* TravelArrivalPoint
|
||||
*
|
||||
* @ORM\Table(name="travel_arrival_point", indexes={@ORM\Index(name="FK_travel_arrival_point_travel_country", columns={"travel_country_id"})})
|
||||
* @ORM\Entity
|
||||
*/
|
||||
class TravelArrivalPoint
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="name", type="string", length=255, nullable=true)
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="IDENTITY")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @var \AppBundle\Entity\TravelCountry
|
||||
*
|
||||
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\TravelCountry")
|
||||
* @ORM\JoinColumns({
|
||||
* @ORM\JoinColumn(name="travel_country_id", referencedColumnName="id")
|
||||
* })
|
||||
*/
|
||||
private $travelCountry;
|
||||
|
||||
/**
|
||||
* @ORM\OneToMany(targetEntity="AppBundle\Entity\TravelDeparturePoint", mappedBy="travelArrivalPoint")
|
||||
*/
|
||||
private $departures;
|
||||
|
||||
/**
|
||||
* Set name
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return TravelArrivalPoint
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set travelCountry
|
||||
*
|
||||
* @param \AppBundle\Entity\TravelCountry $travelCountry
|
||||
*
|
||||
* @return TravelArrivalPoint
|
||||
*/
|
||||
public function setTravelCountry(\AppBundle\Entity\TravelCountry $travelCountry = null)
|
||||
{
|
||||
$this->travelCountry = $travelCountry;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get travelCountry
|
||||
*
|
||||
* @return \AppBundle\Entity\TravelCountry
|
||||
*/
|
||||
public function getTravelCountry()
|
||||
{
|
||||
return $this->travelCountry;
|
||||
}
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->departures = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add departure
|
||||
*
|
||||
* @param \AppBundle\Entity\TravelDeparturePoint $departure
|
||||
*
|
||||
* @return TravelArrivalPoint
|
||||
*/
|
||||
public final function addDeparture(\AppBundle\Entity\TravelDeparturePoint $departure)
|
||||
{
|
||||
if (!$this->__areDeparturesInitialized__ && isset($this->__initializer__))
|
||||
{
|
||||
// Imitate proxy behavior, because this method is final and therefore ignored by the proxy
|
||||
$this->__initializer__->__invoke($this, 'addDeparture', [$departure]);
|
||||
}
|
||||
$this->departures[] = $departure;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public $__initializer__;
|
||||
|
||||
public $__areDeparturesInitialized__ = false;
|
||||
|
||||
/**
|
||||
* Set departures, because the travel date search algorithm already retrieves them at another place. Therefore
|
||||
* the proxy must be prevented from loading the entire entity as soon as the manually attached departures are
|
||||
* accessed. To achieve the prevention, the accessor methods are "final". They imitate the proxy's behavior, in
|
||||
* case they are called and departures haven't been set manually before.
|
||||
*
|
||||
* @param ArrayCollection $departures
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
public final function __setDepartures($departures)
|
||||
{
|
||||
$this->__areDeparturesInitialized__ = true;
|
||||
if ($departures === null)
|
||||
{
|
||||
$this->departures = null;
|
||||
}
|
||||
$this->departures = new ArrayCollection();
|
||||
foreach ($departures as $departure)
|
||||
{
|
||||
$this->departures->add($departure);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove departure
|
||||
*
|
||||
* @param \AppBundle\Entity\TravelDeparturePoint $departure
|
||||
*/
|
||||
public final function removeDeparture(\AppBundle\Entity\TravelDeparturePoint $departure)
|
||||
{
|
||||
if (!$this->__areDeparturesInitialized__ && isset($this->__initializer__))
|
||||
{
|
||||
// Imitate proxy behavior, because this method is final and therefore ignored by the proxy
|
||||
$this->__initializer__->__invoke($this, 'removeDeparture', [$departure]);
|
||||
}
|
||||
$this->departures->removeElement($departure);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get departures
|
||||
*
|
||||
* @return \Doctrine\Common\Collections\Collection|TravelDeparturePoint[]
|
||||
*/
|
||||
public final function getDepartures()
|
||||
{
|
||||
if (!$this->__areDeparturesInitialized__ && isset($this->__initializer__))
|
||||
{
|
||||
// Imitate proxy behavior, because this method is final and therefore ignored by the proxy
|
||||
$this->__initializer__->__invoke($this, 'getDeparture', []);
|
||||
}
|
||||
return $this->departures;
|
||||
}
|
||||
}
|
||||
1434
src/AppBundle/Entity/TravelBooking.php
Normal file
1434
src/AppBundle/Entity/TravelBooking.php
Normal file
File diff suppressed because it is too large
Load diff
430
src/AppBundle/Entity/TravelBookingRepository.php
Normal file
430
src/AppBundle/Entity/TravelBookingRepository.php
Normal file
|
|
@ -0,0 +1,430 @@
|
|||
<?php
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\Mapping\ClassMetadata;
|
||||
|
||||
/**
|
||||
* TravelBookingRepository
|
||||
*
|
||||
* This class was generated by the Doctrine ORM. Add your own custom
|
||||
* repository methods below.
|
||||
*/
|
||||
class TravelBookingRepository extends \Doctrine\ORM\EntityRepository
|
||||
{
|
||||
private $serviceItems = [];
|
||||
private $arrangements = [];
|
||||
|
||||
private function createServiceItem($serviceItemData){
|
||||
$this->serviceItems[] = $serviceItemData;
|
||||
}
|
||||
|
||||
private function createArrangement($arrangementData)
|
||||
{
|
||||
if (isset($arrangementData['data_s']) && is_array($arrangementData['data_s']))
|
||||
{
|
||||
$tmp = [];
|
||||
foreach ($arrangementData['data_s'] as $k => $v)
|
||||
{
|
||||
$tmp[] .= $k .': '. $v;
|
||||
}
|
||||
$arrangementData['data_s'] = implode("\n", $tmp);
|
||||
}
|
||||
$this->arrangements[] = $arrangementData;
|
||||
}
|
||||
|
||||
|
||||
public function createFromBookingRequest(BookingRequest $bookingRequest, TravelDate $travelDate, $bookingPriceInfo)
|
||||
{
|
||||
$tp = $travelDate->getTravelProgram();
|
||||
$ret = new TravelBooking();
|
||||
$startDateStr = $travelDate->getStart()->format('Y-m-d');
|
||||
|
||||
|
||||
$ret->setIp($_SERVER['REMOTE_ADDR']);
|
||||
if(count($tp->getDrafts()) > 0){
|
||||
$newDrafts = true;
|
||||
}else{
|
||||
$newDrafts = false;
|
||||
}
|
||||
|
||||
//##lead createLead
|
||||
$ret->setSalutationId($bookingRequest->getSalutation());
|
||||
$ret->setFirstName($bookingRequest->getFirstName());
|
||||
$ret->setLastName($bookingRequest->getLastName());
|
||||
$ret->setStreet($bookingRequest->getStreetAddress());
|
||||
$ret->setZipcode($bookingRequest->getZipCode());
|
||||
$ret->setCity($bookingRequest->getCity());
|
||||
$ret->setCountryId($bookingRequest->getNation());
|
||||
$ret->setPhone($bookingRequest->getPhone());
|
||||
//phonemobile
|
||||
$ret->setMobile($bookingRequest->getMobile());
|
||||
$ret->setEmail($bookingRequest->getEmail());
|
||||
//remarks
|
||||
$ret->setComments($bookingRequest->getNotes());
|
||||
|
||||
|
||||
//##booking createBooking
|
||||
//booking_date
|
||||
|
||||
$ret->setCreated(new \DateTime());
|
||||
|
||||
//travelperiod_start //start_date
|
||||
$ret->setSelectedStartDate($travelDate->getStart());
|
||||
//travelperiod_end //start_date
|
||||
$ret->setSelectedEndDate($travelDate->getEnd());
|
||||
|
||||
$ret->setProgramName($tp->getTitle() . ' ('. $travelDate->getName() .')');
|
||||
|
||||
$ret->setProgramId($tp->getId());
|
||||
|
||||
$ret->setPeriodId($travelDate->__getTravelPeriod()->getId());
|
||||
|
||||
$countries = [];
|
||||
foreach ($tp->getCountries() as $country){
|
||||
$countries[] = $country->getCrmId();
|
||||
}
|
||||
$ret->setSelectedTravel([
|
||||
'travel_country_id' => $countries,
|
||||
'travel_category_id' => $tp->getTravelCategory(),
|
||||
'travelagenda_id' => $tp->getTravelAgenda(),
|
||||
'travel_title' => $tp->getTitle(),
|
||||
'travel_number' => $travelDate->getName()
|
||||
]);
|
||||
|
||||
$ret->setSelectedDeparture([
|
||||
'name' => $bookingRequest->getDeparture()->getName(),
|
||||
'extra_charge' => $bookingRequest->getDeparture()->getExtraCharge(),
|
||||
'extra_charge_total' => $bookingRequest->getTravelerCount()
|
||||
]);
|
||||
|
||||
$ret->setPrice($bookingPriceInfo['totalWithoutInsurance']);
|
||||
$ret->setPriceTotal($bookingPriceInfo['total']);
|
||||
$ret->setDepositTotal($bookingPriceInfo['deposit_total']);
|
||||
$ret->setFinalPayment($bookingPriceInfo['final_payment']);
|
||||
$ret->setFinalPaymentDate(new \DateTime($bookingPriceInfo['final_payment_date']));
|
||||
|
||||
|
||||
//## traveler createTraveler
|
||||
|
||||
$ret->setSelectedAdults($bookingRequest->getTravelerCount());
|
||||
$ret->setSelectedChilds($bookingRequest->getChildrenCount());
|
||||
|
||||
$ret->setParticipantsTotal($bookingRequest->getTravelerCount() + $bookingRequest->getChildrenCount());
|
||||
$ret->setParticipants($bookingRequest->getTravelers());
|
||||
|
||||
|
||||
|
||||
if ($tp->getIsMediated()) {
|
||||
$serviceItemDefaults = [
|
||||
'travel_company_id' => $tp->getOrganizer()->getCmsId(),
|
||||
'travel_date' => $startDateStr,
|
||||
'commission' => 0,
|
||||
];
|
||||
foreach ($bookingPriceInfo['rooms'] as $room) {
|
||||
$this->createServiceItem($serviceItemDefaults + [
|
||||
'service_price' => $room['price_total'],
|
||||
'name' => $room['name'],
|
||||
]);
|
||||
}
|
||||
$this->createServiceItem($serviceItemDefaults + [
|
||||
'service_price' => $bookingRequest->getTravelerCount() * $bookingPriceInfo['departure']->getExtraCharge(),
|
||||
'name' => $bookingRequest->getTravelerCount() .' x '. $bookingPriceInfo['departure']->getName()
|
||||
]);
|
||||
|
||||
foreach ($bookingRequest->getTravelOptions() as $option) {
|
||||
$this->createServiceItem($serviceItemDefaults + [
|
||||
'service_price' => $option->getPrice() * $bookingRequest->getTravelerCount(),
|
||||
'name' => $bookingRequest->getTravelerCount() .' x '. $option->getName()
|
||||
]);
|
||||
}
|
||||
foreach ($bookingPriceInfo['classOptions'] as $classOption){
|
||||
$this->createServiceItem($serviceItemDefaults + [
|
||||
'service_price' => $classOption['count'] * $classOption['price'],
|
||||
'name' => $classOption['count'] .' x '. $classOption['name']
|
||||
]);
|
||||
}
|
||||
|
||||
} else {
|
||||
if($newDrafts){
|
||||
$ret->setDrafts($this->createNewDrafts($bookingRequest, $tp, $travelDate, $bookingPriceInfo, $startDateStr));
|
||||
}else{
|
||||
//no new Drafts - create the old Arrangements
|
||||
$this->createOldArrangement($bookingRequest, $tp, $travelDate, $bookingPriceInfo, $startDateStr);
|
||||
}
|
||||
}
|
||||
$ret->setServiceItems($this->serviceItems);
|
||||
$ret->setArrangements($this->arrangements);
|
||||
|
||||
$insurance = $bookingRequest->getInsurance();
|
||||
$ret->setInsuranceName($insurance ? $insurance->getName() : '0'); // #TODO Adapted from v2
|
||||
if (empty($bookingPriceInfo['insurances']))
|
||||
{
|
||||
$ret->setInsurances(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
$insurances = [];
|
||||
foreach ($bookingPriceInfo['insurances'] as $insuranceInfo)
|
||||
{
|
||||
$insurances[] = [
|
||||
'travel_company_id' => 30,
|
||||
'service_price' => $insuranceInfo['count'] * $insuranceInfo['insurancePriceValue'],
|
||||
'name' => $insuranceInfo['count'] . 'x ' . $insuranceInfo['insurance']->getName() . ' (' .
|
||||
$insuranceInfo['insurancePrice']->getCode() . ')',
|
||||
'commission' => round(($insuranceInfo['count'] * $insuranceInfo['insurancePriceValue']) * 20 / 100, 2),
|
||||
'count' => $insuranceInfo['count'],
|
||||
'price' => $insuranceInfo['insurancePriceValue'],
|
||||
'code' => $insuranceInfo['insurancePrice']->getCode(),
|
||||
'travel_date' => $startDateStr,
|
||||
];
|
||||
if ($insuranceInfo['countChild'] > 0) {
|
||||
$insurances[] = [
|
||||
'travel_company_id' => 30,
|
||||
'service_price' => $insuranceInfo['countChild'] * $insuranceInfo['insuranceChildPriceValue'],
|
||||
'name' => $insuranceInfo['countChild'] . 'x ' . $insuranceInfo['insurance']->getName() . ' (' .
|
||||
$insuranceInfo['insuranceChildPrice']->getCode() . ')',
|
||||
'commission' => round(($insuranceInfo['countChild'] * $insuranceInfo['insuranceChildPriceValue']) * 20 / 100, 2),
|
||||
'count' => $insuranceInfo['countChild'],
|
||||
'price' => $insuranceInfo['insuranceChildPriceValue'],
|
||||
'code' => $insuranceInfo['insuranceChildPrice']->getCode(),
|
||||
'travel_date' => $startDateStr,
|
||||
];
|
||||
}
|
||||
}
|
||||
$ret->setInsurances($insurances);
|
||||
}
|
||||
|
||||
$ret->setRooms($bookingPriceInfo['rooms']);
|
||||
|
||||
|
||||
|
||||
if (empty($bookingPriceInfo['options']))
|
||||
{
|
||||
$ret->setOptions(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
$options = [];
|
||||
foreach ($bookingPriceInfo['options'] as $option)
|
||||
{
|
||||
$options[] = [
|
||||
'name' => $option->getName(),
|
||||
'price' => $option->getPrice()
|
||||
];
|
||||
}
|
||||
$ret->setOptions($options);
|
||||
}
|
||||
$ret->setClassOptions(false);
|
||||
$ret->setExtraCategory(empty($bookingPriceInfo['classOptions']) ? false : $bookingPriceInfo['classOptions']);
|
||||
$ret->setAcceptLegalRights($bookingRequest->isAcceptLegalRights());
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
private function createNewDrafts(BookingRequest $bookingRequest, TravelProgram $tp, TravelDate $travelDate, $bookingPriceInfo, $startDateStr){
|
||||
//make an request omn the new API
|
||||
$endDateStr = $travelDate->getEnd()->format('Y-m-d');
|
||||
|
||||
$rooms = [];
|
||||
$i = 0;
|
||||
foreach ($bookingPriceInfo['rooms'] as $room)
|
||||
{
|
||||
$rooms[$i] = [
|
||||
'name' => $room['name'],
|
||||
'price_adult' => $room['price'],
|
||||
'adult' => $room['adults'],
|
||||
'children' => 0,
|
||||
'price_children' => 0,
|
||||
'price_children_full' => 0,
|
||||
'price_adult_full' => $room['price_full'],
|
||||
];
|
||||
if($room['children'] > 0){
|
||||
$rooms[$i]['children'] = $room['children'];
|
||||
$rooms[$i]['price_children'] = $room['price_children'];
|
||||
$rooms[$i]['price_children_full'] = $room['price_children_full'];
|
||||
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
$class_options = [];
|
||||
// Actually: extra_category
|
||||
foreach ($bookingPriceInfo['classOptions'] as $classOption)
|
||||
{
|
||||
$class_options[] = [
|
||||
'name' => $classOption['name'],
|
||||
'price' => $classOption['price'],
|
||||
'count' => $classOption['count'],
|
||||
];
|
||||
}
|
||||
$travel_options = [];
|
||||
$i = 0;
|
||||
foreach ($bookingRequest->getTravelOptions() as $option)
|
||||
{
|
||||
$travel_options[$i] = [
|
||||
'name' => $option->getName(),
|
||||
'price_adult' => $option->getPrice(),
|
||||
'adult' => $bookingRequest->getTravelerCount(),
|
||||
'children' => 0,
|
||||
'price_children' => 0,
|
||||
];
|
||||
if($bookingRequest->getChildrenCount() > 0){
|
||||
$travel_options[$i]['children'] = $bookingRequest->getChildrenCount();
|
||||
$travel_options[$i]['price_children'] = $option->getPriceChildren();
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
$dis = [];
|
||||
$i = 0;
|
||||
foreach ($bookingPriceInfo['discount'] as $discount)
|
||||
{
|
||||
$dis[$i] = [
|
||||
'count' => $discount['count'],
|
||||
'value' => $discount['value'],
|
||||
'price' => round($discount['price_discount'], 2)
|
||||
];
|
||||
$i++;
|
||||
}
|
||||
return [
|
||||
'travel_program_id' => $tp->getId(),
|
||||
'comfort' => $bookingRequest->getComfort(),
|
||||
'booking_before' => $bookingPriceInfo['booking_before'],
|
||||
'booking_after' => $bookingPriceInfo['booking_after'],
|
||||
'request_date' => (new \DateTime())->format('Y-m-d'),
|
||||
'startDateStr' => $startDateStr,
|
||||
'endDateStr' => $endDateStr,
|
||||
'departure' => $bookingPriceInfo['departure']->getName(),
|
||||
'departure_extra_charge' => $bookingPriceInfo['departure']->getExtraCharge(),
|
||||
'traveler' => ($bookingRequest->getTravelerCount() + $bookingRequest->getChildrenCount()),
|
||||
'title' => $tp->getTitle(),
|
||||
'number' => $travelDate->getName(),
|
||||
'rooms' => $rooms,
|
||||
'class_options' => $class_options,
|
||||
'travel_options' => $travel_options,
|
||||
'discount' => $dis,
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
private function createOldArrangement(BookingRequest $bookingRequest, TravelProgram $tp, TravelDate $travelDate, $bookingPriceInfo, $startDateStr){
|
||||
$viewPosition = 100;
|
||||
$viewPositionPrice = 50;
|
||||
$endDateStr = $travelDate->getEnd()->format('Y-m-d');
|
||||
|
||||
$arrangementDefaults = [
|
||||
'state' => (new \DateTime())->format('Y-m-d'),
|
||||
'in_pdf' => 1
|
||||
];
|
||||
|
||||
$this->createArrangement( $arrangementDefaults + [
|
||||
'type_id' => 4, // Flug
|
||||
'type_s' => 'Flug',
|
||||
'begin' => $startDateStr,
|
||||
'view_position' => --$viewPosition,
|
||||
'data_s' => ['Hinflug' => 'von '. $bookingPriceInfo['departure']->getName()],
|
||||
]);
|
||||
|
||||
$this->createArrangement( $arrangementDefaults + [
|
||||
'type_id' => 26, // Preisinformation
|
||||
'type_s' => 'Preisinformation',
|
||||
'view_position' => --$viewPositionPrice,
|
||||
'data_s' => [
|
||||
'Name' => 'Abfahrts-/Abflugort '. $bookingPriceInfo['departure']->getName(),
|
||||
'Preis' => $bookingPriceInfo['departure']->getExtraCharge(),
|
||||
'Teilnehmer' => ($bookingRequest->getTravelerCount() + $bookingRequest->getChildrenCount()),
|
||||
],
|
||||
]);
|
||||
|
||||
$this->createArrangement( $arrangementDefaults + [
|
||||
'type_id' => 24, // Rundreise
|
||||
'type_s' => 'Rundreise', // Rundreise
|
||||
'begin' => $startDateStr,
|
||||
'end' => $endDateStr,
|
||||
'view_position' => --$viewPosition,
|
||||
'data_s' => ['Name' => $tp->getTitle() .' ('. $travelDate->getName() .')'],
|
||||
]);
|
||||
|
||||
|
||||
$roomStrs = [];
|
||||
foreach ($bookingPriceInfo['rooms'] as $room)
|
||||
{
|
||||
$roomStrs[] = '1x '. $room['name'];
|
||||
$child = array();
|
||||
if($room['children'] > 0){
|
||||
$child = [
|
||||
'Kind' => $room['children'],
|
||||
'KindPreis' => $room['price_children'],
|
||||
];
|
||||
}
|
||||
$data = [
|
||||
'Name' => 'pro Person im \''. $room['name'] .'\'',
|
||||
'Preis' => $room['price'],
|
||||
'Teilnehmer' => $room['adults'],
|
||||
];
|
||||
$this->createArrangement( $arrangementDefaults + [
|
||||
'type_id' => 26, // Preisinformation
|
||||
'type_s' => 'Preisinformation',
|
||||
'view_position' => --$viewPositionPrice,
|
||||
'data_s' => array_merge($data, $child),
|
||||
]);
|
||||
}
|
||||
|
||||
$this->createArrangement( $arrangementDefaults + [
|
||||
'type_id' => 5, // Hotel
|
||||
'type_s' => 'Hotel',
|
||||
'begin' => $startDateStr,
|
||||
'end' => $endDateStr,
|
||||
'view_position' => --$viewPosition,
|
||||
'data_s' => ['Zimmer' => implode(', ', $roomStrs)],
|
||||
]);
|
||||
|
||||
// Actually: extra_category
|
||||
foreach ($bookingPriceInfo['classOptions'] as $classOption)
|
||||
{
|
||||
$this->createArrangement( $arrangementDefaults + [
|
||||
'type_id' => 26, // Preisinformation
|
||||
'type_s' => 'Preisinformation',
|
||||
'view_position' => --$viewPositionPrice,
|
||||
'data_s' => [
|
||||
'Name' => $classOption['name'],
|
||||
'Preis' => $classOption['price'],
|
||||
'Teilnehmer' => $classOption['count'],
|
||||
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
$this->createArrangement( $arrangementDefaults + [
|
||||
'type_id' => 4, // Flug
|
||||
'type_s' => 'Flug',
|
||||
'begin' => $endDateStr,
|
||||
'view_position' => --$viewPosition,
|
||||
'data_s' => ['Rückflug' => $bookingRequest->getDeparture()->getName()],
|
||||
]);
|
||||
|
||||
|
||||
foreach ($bookingRequest->getTravelOptions() as $option)
|
||||
{
|
||||
$child = array();
|
||||
if($option->getPriceChildren() > 0){
|
||||
$child = [
|
||||
'Kind' => $bookingRequest->getChildrenCount(),
|
||||
'KindPreis' => $option->getPriceChildren(),
|
||||
];
|
||||
}
|
||||
$data = [
|
||||
'Name' => $option->getName(),
|
||||
'Preis' => $option->getPrice(),
|
||||
'Teilnehmer' => $bookingRequest->getTravelerCount(),
|
||||
];
|
||||
$this->createArrangement($arrangementDefaults + [
|
||||
'type_id' => 26, // Preisinformation
|
||||
'type_s' => 'Preisinformation',
|
||||
'view_position' => --$viewPositionPrice,
|
||||
'data_s' => array_merge($data, $child)
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
97
src/AppBundle/Entity/TravelCategory.php
Normal file
97
src/AppBundle/Entity/TravelCategory.php
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
<?php
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* TravelCategory
|
||||
*
|
||||
* @ORM\Table(name="travel_category")
|
||||
* @ORM\Entity
|
||||
*/
|
||||
class TravelCategory
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="name", type="string", length=255, nullable=true)
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="conversion_code", type="text", length=65535, nullable=false)
|
||||
*/
|
||||
private $conversionCode;
|
||||
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="IDENTITY")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Set name
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return TravelCategory
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set conversionCode
|
||||
*
|
||||
* @param string $conversionCode
|
||||
*
|
||||
* @return TravelCategory
|
||||
*/
|
||||
public function setConversionCode($conversionCode)
|
||||
{
|
||||
$this->conversionCode = $conversionCode;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get conversionCode
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getConversionCode()
|
||||
{
|
||||
return $this->conversionCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
}
|
||||
162
src/AppBundle/Entity/TravelClass.php
Normal file
162
src/AppBundle/Entity/TravelClass.php
Normal file
|
|
@ -0,0 +1,162 @@
|
|||
<?php
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* TravelClass
|
||||
*
|
||||
* @ORM\Table(name="travel_class", indexes={@ORM\Index(name="FK_travel_class_travel_program", columns={"program_id"})})
|
||||
* @ORM\Entity
|
||||
*/
|
||||
class TravelClass
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="name", type="string", length=255, nullable=true)
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="description", type="string", length=255, nullable=true)
|
||||
*/
|
||||
private $description;
|
||||
|
||||
/**
|
||||
* @var boolean
|
||||
*
|
||||
* @ORM\Column(name="standard", type="boolean", nullable=false)
|
||||
*/
|
||||
private $standard = '1';
|
||||
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="IDENTITY")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @var \AppBundle\Entity\TravelProgram
|
||||
*
|
||||
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\TravelProgram")
|
||||
* @ORM\JoinColumns({
|
||||
* @ORM\JoinColumn(name="program_id", referencedColumnName="id")
|
||||
* })
|
||||
*/
|
||||
private $program;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Set name
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return TravelClass
|
||||
*/
|
||||
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 TravelClass
|
||||
*/
|
||||
public function setDescription($description)
|
||||
{
|
||||
$this->description = $description;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get description
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDescription()
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set standard
|
||||
*
|
||||
* @param boolean $standard
|
||||
*
|
||||
* @return TravelClass
|
||||
*/
|
||||
public function setStandard($standard)
|
||||
{
|
||||
$this->standard = $standard;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get standard
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getStandard()
|
||||
{
|
||||
return $this->standard;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set program
|
||||
*
|
||||
* @param \AppBundle\Entity\TravelProgram $program
|
||||
*
|
||||
* @return TravelClass
|
||||
*/
|
||||
public function setProgram(\AppBundle\Entity\TravelProgram $program = null)
|
||||
{
|
||||
$this->program = $program;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get program
|
||||
*
|
||||
* @return \AppBundle\Entity\TravelProgram
|
||||
*/
|
||||
public function getProgram()
|
||||
{
|
||||
return $this->program;
|
||||
}
|
||||
}
|
||||
414
src/AppBundle/Entity/TravelCountry.php
Normal file
414
src/AppBundle/Entity/TravelCountry.php
Normal file
|
|
@ -0,0 +1,414 @@
|
|||
<?php
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* TravelCountry
|
||||
*
|
||||
* @ORM\Table(name="travel_country", indexes={@ORM\Index(name="FK_travel_country_page", columns={"feedback_page_id"})})
|
||||
* @ORM\Entity(repositoryClass="AppBundle\Entity\TravelCountryRepository")
|
||||
*/
|
||||
|
||||
class TravelCountry
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="name", type="string", length=255, nullable=true)
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="slug", type="string", length=255, nullable=true)
|
||||
*/
|
||||
private $slug;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="text_before", type="string", length=255, nullable=true)
|
||||
*/
|
||||
private $text_before;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="text_after", type="string", length=255, nullable=true)
|
||||
*/
|
||||
private $text_after;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="html_information", type="text", length=65535, nullable=false)
|
||||
*/
|
||||
private $htmlInformation;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="entry_requirements", type="text", length=65535, nullable=false)
|
||||
*/
|
||||
private $entryRequirements;
|
||||
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="IDENTITY")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* @ORM\Column(name="crm_id", type="integer")
|
||||
*/
|
||||
private $crmId;
|
||||
|
||||
/**
|
||||
* @var boolean
|
||||
*
|
||||
* @ORM\Column(name="active_frontend", type="boolean", nullable=false)
|
||||
*/
|
||||
private $active_frontend;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @var \AppBundle\Entity\Page
|
||||
*
|
||||
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\Page")
|
||||
* @ORM\JoinColumns({
|
||||
* @ORM\JoinColumn(name="feedback_page_id", referencedColumnName="id")
|
||||
* })
|
||||
*/
|
||||
private $feedbackPage;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToMany(targetEntity="AppBundle\Entity\TravelProgram", mappedBy="countries")
|
||||
*/
|
||||
private $programs;
|
||||
|
||||
/**
|
||||
* @ORM\OneToMany(targetEntity="AppBundle\Entity\TravelDestination", mappedBy="country")
|
||||
*/
|
||||
private $destinations;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Set name
|
||||
*
|
||||
* @param string $crmId
|
||||
*
|
||||
* @return TravelCountry
|
||||
*/
|
||||
public function setCrmId($crmId)
|
||||
{
|
||||
$this->crmId = $crmId;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get crmId
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCrmId()
|
||||
{
|
||||
return $this->crmId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set name
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return TravelCountry
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set slug
|
||||
*
|
||||
* @param string $slug
|
||||
*
|
||||
* @return TravelCountry
|
||||
*/
|
||||
public function setSlug($slug)
|
||||
{
|
||||
$this->slug = $slug;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get slug
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSlug()
|
||||
{
|
||||
return $this->slug;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set text_before
|
||||
*
|
||||
* @param string $text_before
|
||||
*
|
||||
* @return TravelCountry
|
||||
*/
|
||||
public function setTextBefore($text_before)
|
||||
{
|
||||
$this->text_before = $text_before;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get text_before
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTextBefore()
|
||||
{
|
||||
return $this->text_before;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set text_after
|
||||
*
|
||||
* @param string $text_after
|
||||
*
|
||||
* @return TravelCountry
|
||||
*/
|
||||
public function setTextAfter($text_after)
|
||||
{
|
||||
$this->text_after = $text_after;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get text_after
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTextAfter()
|
||||
{
|
||||
return $this->text_after;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set htmlInformation
|
||||
*
|
||||
* @param string $htmlInformation
|
||||
*
|
||||
* @return TravelCountry
|
||||
*/
|
||||
public function setHtmlInformation($htmlInformation)
|
||||
{
|
||||
$this->htmlInformation = $htmlInformation;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get htmlInformation
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getHtmlInformation()
|
||||
{
|
||||
return $this->htmlInformation;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set entryRequirements
|
||||
*
|
||||
* @param string $entryRequirements
|
||||
*
|
||||
* @return TravelCountry
|
||||
*/
|
||||
public function setEntryRequirements($entryRequirements)
|
||||
{
|
||||
$this->entryRequirements = $entryRequirements;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get entryRequirements
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getEntryRequirements()
|
||||
{
|
||||
return $this->entryRequirements;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set active_frontend
|
||||
*
|
||||
* @param boolean $active_frontend
|
||||
*
|
||||
* @return TravelClass
|
||||
*/
|
||||
public function setActiveFrontend($active_frontend)
|
||||
{
|
||||
$this->active_frontend = $active_frontend;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get active_frontend
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getActiveFrontend()
|
||||
{
|
||||
return $this->active_frontend;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set feedbackPage
|
||||
*
|
||||
* @param \AppBundle\Entity\Page $feedbackPage
|
||||
*
|
||||
* @return TravelCountry
|
||||
*/
|
||||
public function setFeedbackPage(\AppBundle\Entity\Page $feedbackPage = null)
|
||||
{
|
||||
$this->feedbackPage = $feedbackPage;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get feedbackPage
|
||||
*
|
||||
* @return \AppBundle\Entity\Page
|
||||
*/
|
||||
public function getFeedbackPage()
|
||||
{
|
||||
return $this->feedbackPage;
|
||||
}
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->programs = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add program
|
||||
*
|
||||
* @param \AppBundle\Entity\TravelProgram $program
|
||||
*
|
||||
* @return TravelCountry
|
||||
*/
|
||||
public function addProgram(\AppBundle\Entity\TravelProgram $program)
|
||||
{
|
||||
$this->programs[] = $program;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove program
|
||||
*
|
||||
* @param \AppBundle\Entity\TravelProgram $program
|
||||
*/
|
||||
public function removeProgram(\AppBundle\Entity\TravelProgram $program)
|
||||
{
|
||||
$this->programs->removeElement($program);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get programs
|
||||
*
|
||||
* @return \Doctrine\Common\Collections\Collection
|
||||
*/
|
||||
public function getPrograms()
|
||||
{
|
||||
return $this->programs;
|
||||
}
|
||||
|
||||
function __toString()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Add destination
|
||||
*
|
||||
* @param \AppBundle\Entity\TravelDestination $destination
|
||||
*
|
||||
* @return TravelCountry
|
||||
*/
|
||||
public function addDestination(\AppBundle\Entity\TravelDestination $destination)
|
||||
{
|
||||
$this->destinations[] = $destination;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove destination
|
||||
*
|
||||
* @param \AppBundle\Entity\TravelDestination $destination
|
||||
*/
|
||||
public function removeDestination(\AppBundle\Entity\TravelDestination $destination)
|
||||
{
|
||||
$this->destinations->removeElement($destination);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get destinations
|
||||
*
|
||||
* @return \Doctrine\Common\Collections\Collection
|
||||
*/
|
||||
public function getDestinations()
|
||||
{
|
||||
return $this->destinations;
|
||||
}
|
||||
}
|
||||
30
src/AppBundle/Entity/TravelCountryRepository.php
Normal file
30
src/AppBundle/Entity/TravelCountryRepository.php
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
/**
|
||||
* SidebarWidgetRepository
|
||||
*
|
||||
* This class was generated by the Doctrine ORM. Add your own custom
|
||||
* repository methods below.
|
||||
*/
|
||||
class TravelCountryRepository extends \Doctrine\ORM\EntityRepository
|
||||
{
|
||||
|
||||
public function getActiveFrontend()
|
||||
{
|
||||
$qb = $this->createQueryBuilder('travel_country');
|
||||
$qb->where('travel_country.active_frontend = 1')
|
||||
->addOrderBy('travel_country.id', 'ASC');
|
||||
$results = $qb->getQuery()->getResult();
|
||||
|
||||
/* $ret = [];
|
||||
foreach ($results as $result)
|
||||
{
|
||||
if($result->getIsShowAt($site)){
|
||||
$ret[] = $result;
|
||||
}
|
||||
}*/
|
||||
return $results;
|
||||
}
|
||||
}
|
||||
348
src/AppBundle/Entity/TravelDate.php
Normal file
348
src/AppBundle/Entity/TravelDate.php
Normal file
|
|
@ -0,0 +1,348 @@
|
|||
<?php
|
||||
/**
|
||||
* @author Ulrich Hecht <ulrich.hecht@hecht-software.de>
|
||||
* @date 11/03/2016
|
||||
*/
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
use AppBundle\Util\DepartureUtil;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
|
||||
/**
|
||||
* TravelDate is a wrapper for TravelPeriod + start date and end date. This entity doesn't represent a database
|
||||
* table. It was introduced because of requirement to keep the bad original database design in which a TravelPeriod
|
||||
* serves two purposes:
|
||||
* - Representing a season
|
||||
* - Representing a single travel date (by being linked to a TravelPeriodDate-instance)
|
||||
* Also TravelPeriodDate has two purposes:
|
||||
* - Representing a time period of a season. From this time period, multiple travel dates are derived by taking
|
||||
* the possible weekdays into account
|
||||
* - Holding the start and end date for a TravelPeriod that is not a season (see above)
|
||||
*
|
||||
* To avoid further confusion and to slowly move away from this design, "TravelDate" has been invented, which has single
|
||||
* clearly defined purpose:
|
||||
* Representing a single travel date, i.e.
|
||||
* - time period a traveller starts and ends his/her journey
|
||||
* - prices
|
||||
* - availability
|
||||
* - departure locations and their prices
|
||||
*
|
||||
* "TravelPeriod" would be a more fitting name, but this name is already in use.
|
||||
*
|
||||
* @package AppBundle\Entity
|
||||
*/
|
||||
final class TravelDate
|
||||
{
|
||||
/** @var String $key */
|
||||
private $key;
|
||||
|
||||
/** @var TravelPeriod $travelPeriod */
|
||||
private $travelPeriod;
|
||||
|
||||
/** @var \DateTime $start */
|
||||
private $start;
|
||||
|
||||
/** @var \DateTime $end */
|
||||
private $end;
|
||||
|
||||
private $index;
|
||||
|
||||
/** @var FlightPeriod $flightPeriod */
|
||||
private $flightPeriod;
|
||||
|
||||
private $currencyFactor;
|
||||
|
||||
private $travelProgram;
|
||||
|
||||
/** @var TravelDeparturePoint[]|null $departures Departures cache */
|
||||
private $departures = null;
|
||||
|
||||
/** @var TravelPeriodPrice[]|null $prices Prices cache */
|
||||
private $prices = null;
|
||||
|
||||
private $calculatedEffectivePrices = false;
|
||||
|
||||
/**
|
||||
* TravelDate constructor.
|
||||
*
|
||||
* @param String $key
|
||||
* @param TravelPeriod $travelPeriod
|
||||
* @param FlightPeriod|null $flightPeriod
|
||||
* @param float $currencyFactor
|
||||
* @param \DateTime $start
|
||||
* @param \DateTime $end Optional. Computed from travel duration, if not specified.
|
||||
* @param null $index
|
||||
*
|
||||
* @todo Make this object immutable
|
||||
*/
|
||||
public function __construct($key, TravelPeriod $travelPeriod, FlightPeriod $flightPeriod = null, $currencyFactor,
|
||||
\DateTime $start = null, \DateTime $end = null, $index = null)
|
||||
{
|
||||
if ($travelPeriod->getIsSeason())
|
||||
{
|
||||
if ($index === null)
|
||||
{
|
||||
throw new \InvalidArgumentException('Expected numeric value for argument $index due to virtual travel date. Got null.');
|
||||
}
|
||||
if ($start === null)
|
||||
{
|
||||
throw new \InvalidArgumentException('Expected DateTime value for argument $start due to virtual travel date. Got null.');
|
||||
}
|
||||
$this->start = $start;
|
||||
$this->index = $index;
|
||||
$this->prices = [];
|
||||
foreach ($travelPeriod->getPrices() as $price)
|
||||
{
|
||||
$this->prices[$price->getPriceTypeId()] = clone $price;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->start = $travelPeriod->getStartDate();
|
||||
$this->prices = $travelPeriod->getPrices();
|
||||
}
|
||||
$this->flightPeriod = $flightPeriod;
|
||||
$this->travelProgram = $travelPeriod->getProgram();
|
||||
$this->key = $key;
|
||||
$this->travelPeriod = $travelPeriod;
|
||||
|
||||
if ($end === null)
|
||||
{
|
||||
$this->end = clone $this->start;
|
||||
$this->end->modify('+'. $this->travelProgram->getProgramDuration() .' day');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->end = $end;
|
||||
}
|
||||
$this->currencyFactor = $currencyFactor;
|
||||
}
|
||||
|
||||
public static function createForNonSeasonTravelPeriod($key, TravelPeriod $travelPeriod,
|
||||
FlightPeriod $flightPeriod = null, $currencyFactor)
|
||||
{
|
||||
if ($travelPeriod->getIsSeason())
|
||||
{
|
||||
throw new \Exception('Expected non-season TravelPeriod instance');
|
||||
}
|
||||
return new TravelDate($key, $travelPeriod, $flightPeriod, $currencyFactor);
|
||||
}
|
||||
|
||||
public static function createForSeasonTravelPeriod($key, TravelPeriod $travelPeriod, $index, \DateTime $start,
|
||||
\DateTime $end = null, FlightPeriod $flightPeriod = null, $currencyFactor)
|
||||
{
|
||||
if (!$travelPeriod->getIsSeason())
|
||||
{
|
||||
throw new \Exception('Expected season TravelPeriod instance');
|
||||
}
|
||||
return new TravelDate($key, $travelPeriod, $flightPeriod, $currencyFactor, $start, $end, $index);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return String
|
||||
*/
|
||||
public function getKey()
|
||||
{
|
||||
return $this->key;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \DateTime
|
||||
*/
|
||||
public function getStart()
|
||||
{
|
||||
return $this->start;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \DateTime
|
||||
*/
|
||||
public function getStartWeekday()
|
||||
{
|
||||
return $this->start->format('w');
|
||||
}
|
||||
|
||||
public function getFinalPaymentDate()
|
||||
{
|
||||
$pDate = strtotime('-4 week', $this->getStart()->getTimestamp());
|
||||
if($pDate <= time()){
|
||||
$pDate = time();
|
||||
}
|
||||
return date('d.m.Y',$pDate);
|
||||
}
|
||||
|
||||
public function getFinalPaymentDateStr()
|
||||
{
|
||||
$pDate = strtotime('-4 week', $this->getStart()->getTimestamp());
|
||||
if($pDate <= time()){
|
||||
return "ist sofort fällig";
|
||||
}
|
||||
return "bis zum ".date('d.m.Y',$pDate);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return \DateTime
|
||||
*/
|
||||
public function getEnd()
|
||||
{
|
||||
return $this->end;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return $this->travelPeriod->getIsSeason()
|
||||
? (trim($this->travelProgram->getProgramCode()) . $this->index)
|
||||
: $this->travelPeriod->getName()
|
||||
;
|
||||
}
|
||||
|
||||
public function getStatus()
|
||||
{
|
||||
return $this->travelPeriod->getStatus();
|
||||
}
|
||||
|
||||
public function getEffectiveStatus()
|
||||
{
|
||||
if ($this->getStatus() == 2 && $this->getStart()->getTimestamp() < time() + 2419200)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
return $this->getStatus();
|
||||
}
|
||||
|
||||
public function getDepartures()
|
||||
{
|
||||
if ($this->departures === null)
|
||||
{
|
||||
if ($this->travelProgram->getIsMediated())
|
||||
{
|
||||
$defaultDepartures = $this->travelProgram->getDepartures();
|
||||
$departures = $this->travelPeriod->getDepartures();
|
||||
}
|
||||
else
|
||||
{
|
||||
$defaultDepartures = $this->travelProgram->getTravelArrivalPoint()->getDepartures();
|
||||
$departures = $this->flightPeriod === null ? [] : $this->flightPeriod->getDepartures();
|
||||
}
|
||||
$defaultDepartures = DepartureUtil::filterDeparturesByPeriod($defaultDepartures, $this->start, $this->end, true);
|
||||
$this->departures = DepartureUtil::mergeDeparturesWithDefaults($departures, $defaultDepartures, true);
|
||||
}
|
||||
return $this->departures;
|
||||
}
|
||||
|
||||
public function getFlightPrice()
|
||||
{
|
||||
if ($this->travelProgram->getIsMediated())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
$flightPrice = null;
|
||||
if ($this->flightPeriod !== null)
|
||||
{
|
||||
$flightPrice = $this->flightPeriod->getPrice();
|
||||
}
|
||||
if ($flightPrice === null)
|
||||
{
|
||||
$flightPrice = $this->travelProgram->getDefaultFlightPrice();
|
||||
}
|
||||
return $flightPrice;
|
||||
}
|
||||
|
||||
|
||||
public function getFlightCalcPrice()
|
||||
{
|
||||
$flightPrice = $this->getFlightPrice();
|
||||
if ($this->travelProgram->getIsMediated())
|
||||
{
|
||||
$profitMargin = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$profitMargin = $this->travelProgram->getProfitMargin() / 100 + 1;
|
||||
}
|
||||
$currencyFactor = $this->travelProgram->getNettoPricesInEuro() ? 1 : $this->currencyFactor;
|
||||
return round(($flightPrice * $currencyFactor) * $profitMargin);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return TravelPeriodPrice[]|\Doctrine\Common\Collections\Collection
|
||||
*/
|
||||
public function getPrices()
|
||||
{
|
||||
if (!$this->calculatedEffectivePrices)
|
||||
{
|
||||
$this->calculatedEffectivePrices = true;
|
||||
$flightPrice = $this->getFlightPrice();
|
||||
if ($this->travelProgram->getIsMediated())
|
||||
{
|
||||
$profitMargin = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$profitMargin = $this->travelProgram->getProfitMargin() / 100 + 1;
|
||||
}
|
||||
$currencyFactor = $this->travelProgram->getNettoPricesInEuro() ? 1 : $this->currencyFactor;
|
||||
foreach ($this->prices as &$price)
|
||||
{
|
||||
$price->setEffectivePrice(round(($flightPrice + $price->getPrice() * $currencyFactor) * $profitMargin));
|
||||
$price->setEffectiveComfortPrice(round($price->getPriceComfort() * $currencyFactor * $profitMargin));
|
||||
$price->setEffectiveChildPrice(round(($flightPrice + $price->getPriceChildren() * $currencyFactor) * $profitMargin));
|
||||
|
||||
$price->setEffectiveExtraPrice(round($price->getExtraPrice() * $currencyFactor * $profitMargin));
|
||||
$price->setEffectiveExtraComfortPrice(round($price->getExtraPriceComfort() * $currencyFactor * $profitMargin));
|
||||
$price->setEffectiveExtraChildPrice(round($price->getExtraPriceChildren() * $currencyFactor * $profitMargin));
|
||||
}
|
||||
}
|
||||
return $this->prices;
|
||||
}
|
||||
|
||||
public function getLowestPrice()
|
||||
{
|
||||
$lowest = -1;
|
||||
foreach ($this->getPrices() as $price)
|
||||
{
|
||||
if ($price->getPriceTypeId() == 3)
|
||||
{
|
||||
// Use double room if available (#1076)
|
||||
return $price->getEffectiveDiscountPrice() ?? $price->getEffectivePrice();
|
||||
}
|
||||
if ($lowest < 0 || $price->getEffectivePrice() < 0)
|
||||
{
|
||||
$lowest = $price->getEffectivePrice();
|
||||
}
|
||||
|
||||
}
|
||||
return $lowest == -1 ? null : $lowest;
|
||||
}
|
||||
|
||||
public function hasComfortCategory()
|
||||
{
|
||||
foreach ($this->getPrices() as $price)
|
||||
{
|
||||
if ($price->getPriceComfort() > 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return TravelProgram
|
||||
*/
|
||||
public function getTravelProgram(): TravelProgram
|
||||
{
|
||||
return $this->travelProgram;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return TravelPeriod
|
||||
* @internal
|
||||
*/
|
||||
public function __getTravelPeriod()
|
||||
{
|
||||
return $this->travelPeriod;
|
||||
}
|
||||
}
|
||||
388
src/AppBundle/Entity/TravelDeparturePoint.php
Normal file
388
src/AppBundle/Entity/TravelDeparturePoint.php
Normal file
|
|
@ -0,0 +1,388 @@
|
|||
<?php
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* TravelDeparturePoint
|
||||
*
|
||||
* @ORM\Table(name="travel_departure_point", uniqueConstraints={@ORM\UniqueConstraint(name="UK_flight_period_id_name", columns={"flight_period_id", "name"}), @ORM\UniqueConstraint(name="UK_travel_arrival_point_id_name", columns={"travel_arrival_point_id", "name"}), @ORM\UniqueConstraint(name="UK_program_id_name", columns={"program_id", "name"}), @ORM\UniqueConstraint(name="UK_period_id_name", columns={"period_id", "name"})}, indexes={@ORM\Index(name="FK_travel_departure_point_travel_program", columns={"program_id"}), @ORM\Index(name="FK_travel_departure_point_flight_period", columns={"flight_period_id"}), @ORM\Index(name="FK_travel_departure_point_travel_arrival_point", columns={"travel_arrival_point_id"})})
|
||||
* @ORM\Entity(repositoryClass="AppBundle\Entity\TravelDeparturePointRepository")
|
||||
*/
|
||||
class TravelDeparturePoint
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="name", type="string", length=255, nullable=true)
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="extra_charge", type="string", length=255, nullable=true)
|
||||
*/
|
||||
private $extraCharge;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="days", type="string", length=255, nullable=true)
|
||||
*/
|
||||
private $days;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="flight_time", type="text", length=65535, nullable=true)
|
||||
*/
|
||||
private $flightTime;
|
||||
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="departure_type", type="string", nullable=true)
|
||||
*/
|
||||
private $departureType;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="`3letter`", type="string", length=255, nullable=true)
|
||||
*/
|
||||
private $three_letter;
|
||||
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="IDENTITY")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @var \AppBundle\Entity\FlightPeriod
|
||||
*
|
||||
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\FlightPeriod", inversedBy="departures")
|
||||
* @ORM\JoinColumns({
|
||||
* @ORM\JoinColumn(name="flight_period_id", referencedColumnName="id")
|
||||
* })
|
||||
*/
|
||||
private $flightPeriod;
|
||||
|
||||
/**
|
||||
* @var \AppBundle\Entity\TravelArrivalPoint
|
||||
*
|
||||
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\TravelArrivalPoint", inversedBy="departures")
|
||||
* @ORM\JoinColumns({
|
||||
* @ORM\JoinColumn(name="travel_arrival_point_id", referencedColumnName="id")
|
||||
* })
|
||||
*/
|
||||
private $travelArrivalPoint;
|
||||
|
||||
/**
|
||||
* @var \AppBundle\Entity\TravelProgram
|
||||
*
|
||||
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\TravelProgram", inversedBy="departures")
|
||||
* @ORM\JoinColumns({
|
||||
* @ORM\JoinColumn(name="program_id", referencedColumnName="id")
|
||||
* })
|
||||
*/
|
||||
private $program;
|
||||
|
||||
/**
|
||||
* @var TravelPeriod
|
||||
*
|
||||
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\TravelPeriod", inversedBy="departures")
|
||||
* @ORM\JoinColumns({
|
||||
* @ORM\JoinColumn(name="period_id", referencedColumnName="id")
|
||||
* })
|
||||
*/
|
||||
private $travelPeriod;
|
||||
|
||||
private $isVirtual = null;
|
||||
|
||||
/**
|
||||
* Set name
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return TravelDeparturePoint
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set extraCharge
|
||||
*
|
||||
* @param string $extraCharge
|
||||
*
|
||||
* @return TravelDeparturePoint
|
||||
*/
|
||||
public function setExtraCharge($extraCharge)
|
||||
{
|
||||
$this->extraCharge = $extraCharge;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get extraCharge
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function getExtraCharge()
|
||||
{
|
||||
return ($this->extraCharge === null || $this->extraCharge === '') ? null : floatval($this->extraCharge);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set days
|
||||
*
|
||||
* @param string $days
|
||||
*
|
||||
* @return TravelDeparturePoint
|
||||
*/
|
||||
public function setDays($days)
|
||||
{
|
||||
$this->days = $days;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get days
|
||||
*
|
||||
* @return array|int[]
|
||||
*/
|
||||
public function getDays()
|
||||
{
|
||||
return $this->days == null ? null : json_decode($this->days);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set days
|
||||
*
|
||||
* @param string $flightTime
|
||||
*
|
||||
* @return TravelDeparturePoint
|
||||
*/
|
||||
public function setFlightTime($flightTime)
|
||||
{
|
||||
$this->flightTime = $flightTime;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get flightTime
|
||||
*
|
||||
* @return array|int[]
|
||||
*/
|
||||
public function getFlightTime()
|
||||
{
|
||||
|
||||
return $this->flightTime == null ? null : json_decode($this->flightTime, true);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set departureType
|
||||
*
|
||||
* @param string $departureType
|
||||
*
|
||||
* @return TravelDeparturePoint
|
||||
*/
|
||||
public function setDepartureType($departureType)
|
||||
{
|
||||
$this->departureType = $departureType;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get departureType
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDepartureType()
|
||||
{
|
||||
return $this->departureType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set threeLetter
|
||||
*
|
||||
* @param string $threeLetter
|
||||
*
|
||||
* @return TravelDeparturePoint
|
||||
*/
|
||||
public function setThreeLetter($threeLetter)
|
||||
{
|
||||
$this->three_letter = $threeLetter;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get threeLetter
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getThreeLetter()
|
||||
{
|
||||
return $this->three_letter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set flightPeriod
|
||||
*
|
||||
* @param \AppBundle\Entity\FlightPeriod $flightPeriod
|
||||
*
|
||||
* @return TravelDeparturePoint
|
||||
*/
|
||||
public function setFlightPeriod(\AppBundle\Entity\FlightPeriod $flightPeriod = null)
|
||||
{
|
||||
$this->flightPeriod = $flightPeriod;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get flightPeriod
|
||||
*
|
||||
* @return \AppBundle\Entity\FlightPeriod
|
||||
*/
|
||||
public function getFlightPeriod()
|
||||
{
|
||||
return $this->flightPeriod;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set travelArrivalPoint
|
||||
*
|
||||
* @param \AppBundle\Entity\TravelArrivalPoint $travelArrivalPoint
|
||||
*
|
||||
* @return TravelDeparturePoint
|
||||
*/
|
||||
public function setTravelArrivalPoint(\AppBundle\Entity\TravelArrivalPoint $travelArrivalPoint = null)
|
||||
{
|
||||
$this->travelArrivalPoint = $travelArrivalPoint;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get travelArrivalPoint
|
||||
*
|
||||
* @return \AppBundle\Entity\TravelArrivalPoint
|
||||
*/
|
||||
public function getTravelArrivalPoint()
|
||||
{
|
||||
return $this->travelArrivalPoint;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set program
|
||||
*
|
||||
* @param \AppBundle\Entity\TravelProgram $program
|
||||
*
|
||||
* @return TravelDeparturePoint
|
||||
*/
|
||||
public function setProgram(\AppBundle\Entity\TravelProgram $program = null)
|
||||
{
|
||||
$this->program = $program;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get program
|
||||
*
|
||||
* @return \AppBundle\Entity\TravelProgram
|
||||
*/
|
||||
public function getProgram()
|
||||
{
|
||||
return $this->program;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set travelPeriod
|
||||
*
|
||||
* @param \AppBundle\Entity\TravelPeriod $travelPeriod
|
||||
*
|
||||
* @return TravelDeparturePoint
|
||||
*/
|
||||
public function setTravelPeriod(\AppBundle\Entity\TravelPeriod $travelPeriod = null)
|
||||
{
|
||||
$this->travelPeriod = $travelPeriod;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get travelPeriod
|
||||
*
|
||||
* @return \AppBundle\Entity\TravelPeriod
|
||||
*/
|
||||
public function getTravelPeriod()
|
||||
{
|
||||
return $this->travelPeriod;
|
||||
}
|
||||
|
||||
public function getIsEmpty()
|
||||
{
|
||||
return !isset($this->extraCharge) || $this->extraCharge == '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return boolean
|
||||
*/
|
||||
public function getIsVirtual()
|
||||
{
|
||||
return $this->isVirtual;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param boolean $isVirtual
|
||||
*/
|
||||
public function setIsVirtual($isVirtual)
|
||||
{
|
||||
$this->isVirtual = $isVirtual;
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
return $this->getName() .' ('. number_format($this->getExtraCharge(), 2, ',', '.') .' €)';
|
||||
}
|
||||
}
|
||||
162
src/AppBundle/Entity/TravelDeparturePointHoliday.php
Normal file
162
src/AppBundle/Entity/TravelDeparturePointHoliday.php
Normal file
|
|
@ -0,0 +1,162 @@
|
|||
<?php
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* TravelDeparturePointHoliday
|
||||
*
|
||||
* @ORM\Table(name="travel_departure_point_holiday", indexes={@ORM\Index(name="FK_travel_departure_point_holiday_travel_departure_point", columns={"departure_point_id"})})
|
||||
* @ORM\Entity
|
||||
*/
|
||||
class TravelDeparturePointHoliday
|
||||
{
|
||||
/**
|
||||
* @var \DateTime
|
||||
*
|
||||
* @ORM\Column(name="start_date", type="date", nullable=true)
|
||||
*/
|
||||
private $startDate;
|
||||
|
||||
/**
|
||||
* @var \DateTime
|
||||
*
|
||||
* @ORM\Column(name="end_date", type="date", nullable=true)
|
||||
*/
|
||||
private $endDate;
|
||||
|
||||
/**
|
||||
* @var float
|
||||
*
|
||||
* @ORM\Column(name="extra_charge", type="float", precision=10, scale=2, nullable=true)
|
||||
*/
|
||||
private $extraCharge;
|
||||
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="IDENTITY")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @var \AppBundle\Entity\TravelDeparturePoint
|
||||
*
|
||||
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\TravelDeparturePoint")
|
||||
* @ORM\JoinColumns({
|
||||
* @ORM\JoinColumn(name="departure_point_id", referencedColumnName="id")
|
||||
* })
|
||||
*/
|
||||
private $departurePoint;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Set startDate
|
||||
*
|
||||
* @param \DateTime $startDate
|
||||
*
|
||||
* @return TravelDeparturePointHoliday
|
||||
*/
|
||||
public function setStartDate($startDate)
|
||||
{
|
||||
$this->startDate = $startDate;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get startDate
|
||||
*
|
||||
* @return \DateTime
|
||||
*/
|
||||
public function getStartDate()
|
||||
{
|
||||
return $this->startDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set endDate
|
||||
*
|
||||
* @param \DateTime $endDate
|
||||
*
|
||||
* @return TravelDeparturePointHoliday
|
||||
*/
|
||||
public function setEndDate($endDate)
|
||||
{
|
||||
$this->endDate = $endDate;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get endDate
|
||||
*
|
||||
* @return \DateTime
|
||||
*/
|
||||
public function getEndDate()
|
||||
{
|
||||
return $this->endDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set extraCharge
|
||||
*
|
||||
* @param float $extraCharge
|
||||
*
|
||||
* @return TravelDeparturePointHoliday
|
||||
*/
|
||||
public function setExtraCharge($extraCharge)
|
||||
{
|
||||
$this->extraCharge = $extraCharge;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get extraCharge
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function getExtraCharge()
|
||||
{
|
||||
return $this->extraCharge;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set departurePoint
|
||||
*
|
||||
* @param \AppBundle\Entity\TravelDeparturePoint $departurePoint
|
||||
*
|
||||
* @return TravelDeparturePointHoliday
|
||||
*/
|
||||
public function setDeparturePoint(\AppBundle\Entity\TravelDeparturePoint $departurePoint = null)
|
||||
{
|
||||
$this->departurePoint = $departurePoint;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get departurePoint
|
||||
*
|
||||
* @return \AppBundle\Entity\TravelDeparturePoint
|
||||
*/
|
||||
public function getDeparturePoint()
|
||||
{
|
||||
return $this->departurePoint;
|
||||
}
|
||||
}
|
||||
8
src/AppBundle/Entity/TravelDeparturePointRepository.php
Normal file
8
src/AppBundle/Entity/TravelDeparturePointRepository.php
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
class TravelDeparturePointRepository extends \Doctrine\ORM\EntityRepository
|
||||
{
|
||||
|
||||
}
|
||||
99
src/AppBundle/Entity/TravelDestination.php
Normal file
99
src/AppBundle/Entity/TravelDestination.php
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
<?php
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* TravelDestination
|
||||
*
|
||||
* @ORM\Table(name="travel_destination", indexes={@ORM\Index(name="FK_travel_destination_travel_country", columns={"country_id"})})
|
||||
* @ORM\Entity
|
||||
*/
|
||||
class TravelDestination
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="name", type="string", length=255, nullable=true)
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="IDENTITY")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @var \AppBundle\Entity\TravelCountry
|
||||
*
|
||||
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\TravelCountry", inversedBy="destinations")
|
||||
* @ORM\JoinColumns({
|
||||
* @ORM\JoinColumn(name="country_id", referencedColumnName="id")
|
||||
* })
|
||||
*/
|
||||
private $country;
|
||||
|
||||
|
||||
/**
|
||||
* Set name
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return TravelDestination
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set country
|
||||
*
|
||||
* @param \AppBundle\Entity\TravelCountry $country
|
||||
*
|
||||
* @return TravelDestination
|
||||
*/
|
||||
public function setCountry(\AppBundle\Entity\TravelCountry $country = null)
|
||||
{
|
||||
$this->country = $country;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get country
|
||||
*
|
||||
* @return \AppBundle\Entity\TravelCountry
|
||||
*/
|
||||
public function getCountry()
|
||||
{
|
||||
return $this->country;
|
||||
}
|
||||
}
|
||||
224
src/AppBundle/Entity/TravelDiscount.php
Normal file
224
src/AppBundle/Entity/TravelDiscount.php
Normal file
|
|
@ -0,0 +1,224 @@
|
|||
<?php
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* TravelDiscount
|
||||
*
|
||||
* @ORM\Table(name="travel_discount", indexes={@ORM\Index(name="FK_discount_travel_period", columns={"period_id"})})
|
||||
* @ORM\Entity
|
||||
*/
|
||||
class TravelDiscount
|
||||
{
|
||||
/**
|
||||
* @var float
|
||||
*
|
||||
* @ORM\Column(name="value", type="float", precision=10, scale=2, nullable=true)
|
||||
*/
|
||||
private $value;
|
||||
|
||||
/**
|
||||
* @var boolean
|
||||
*
|
||||
* @ORM\Column(name="percent", type="boolean", nullable=true)
|
||||
*/
|
||||
private $percent = '0';
|
||||
|
||||
/**
|
||||
* @var \DateTime
|
||||
*
|
||||
* @ORM\Column(name="start", type="date", nullable=true)
|
||||
*/
|
||||
private $start;
|
||||
|
||||
/**
|
||||
* @var \DateTime
|
||||
*
|
||||
* @ORM\Column(name="end", type="date", nullable=true)
|
||||
*/
|
||||
private $end;
|
||||
|
||||
/**
|
||||
* @var boolean
|
||||
*
|
||||
* @ORM\Column(name="priority", type="boolean", nullable=true)
|
||||
*/
|
||||
private $priority = '0';
|
||||
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="IDENTITY")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @var \AppBundle\Entity\TravelPeriod
|
||||
*
|
||||
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\TravelPeriod", inversedBy="discounts")
|
||||
* @ORM\JoinColumns({
|
||||
* @ORM\JoinColumn(name="period_id", referencedColumnName="id")
|
||||
* })
|
||||
*/
|
||||
private $period;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Set value
|
||||
*
|
||||
* @param float $value
|
||||
*
|
||||
* @return TravelDiscount
|
||||
*/
|
||||
public function setValue($value)
|
||||
{
|
||||
$this->value = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get value
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function getValue()
|
||||
{
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set percent
|
||||
*
|
||||
* @param boolean $percent
|
||||
*
|
||||
* @return TravelDiscount
|
||||
*/
|
||||
public function setPercent($percent)
|
||||
{
|
||||
$this->percent = $percent;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get percent
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getPercent()
|
||||
{
|
||||
return $this->percent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set start
|
||||
*
|
||||
* @param \DateTime $start
|
||||
*
|
||||
* @return TravelDiscount
|
||||
*/
|
||||
public function setStart($start)
|
||||
{
|
||||
$this->start = $start;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get start
|
||||
*
|
||||
* @return \DateTime
|
||||
*/
|
||||
public function getStart()
|
||||
{
|
||||
return $this->start;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set end
|
||||
*
|
||||
* @param \DateTime $end
|
||||
*
|
||||
* @return TravelDiscount
|
||||
*/
|
||||
public function setEnd($end)
|
||||
{
|
||||
$this->end = $end;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get end
|
||||
*
|
||||
* @return \DateTime
|
||||
*/
|
||||
public function getEnd()
|
||||
{
|
||||
return $this->end;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set priority
|
||||
*
|
||||
* @param boolean $priority
|
||||
*
|
||||
* @return TravelDiscount
|
||||
*/
|
||||
public function setPriority($priority)
|
||||
{
|
||||
$this->priority = $priority;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get priority
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getPriority()
|
||||
{
|
||||
return $this->priority;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set period
|
||||
*
|
||||
* @param \AppBundle\Entity\TravelPeriod $period
|
||||
*
|
||||
* @return TravelDiscount
|
||||
*/
|
||||
public function setPeriod(\AppBundle\Entity\TravelPeriod $period = null)
|
||||
{
|
||||
$this->period = $period;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get period
|
||||
*
|
||||
* @return \AppBundle\Entity\TravelPeriod
|
||||
*/
|
||||
public function getPeriod()
|
||||
{
|
||||
return $this->period;
|
||||
}
|
||||
}
|
||||
97
src/AppBundle/Entity/TravelGeneralNote.php
Normal file
97
src/AppBundle/Entity/TravelGeneralNote.php
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
<?php
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* TravelGeneralNote
|
||||
*
|
||||
* @ORM\Table(name="travel_general_notes")
|
||||
* @ORM\Entity
|
||||
*/
|
||||
class TravelGeneralNote
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="name", type="string", length=255, nullable=true)
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="text", type="text", length=65535, nullable=false)
|
||||
*/
|
||||
private $text;
|
||||
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="IDENTITY")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Set name
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return TravelGeneralNote
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set text
|
||||
*
|
||||
* @param string $text
|
||||
*
|
||||
* @return TravelGeneralNote
|
||||
*/
|
||||
public function setText($text)
|
||||
{
|
||||
$this->text = $text;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get text
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getText()
|
||||
{
|
||||
return $this->text;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
}
|
||||
24
src/AppBundle/Entity/TravelGuideRepository.php
Normal file
24
src/AppBundle/Entity/TravelGuideRepository.php
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
/**
|
||||
* TravelGuideRepository
|
||||
*
|
||||
* This class was generated by the Doctrine ORM. Add your own custom
|
||||
* repository methods below.
|
||||
*/
|
||||
class TravelGuideRepository extends \Doctrine\ORM\EntityRepository
|
||||
{
|
||||
public function findByID($id)
|
||||
{
|
||||
$qb = $this->getEntityManager()->createQueryBuilder();
|
||||
$qb->select('tg');
|
||||
$qb->from('AppBundle:TravelGuides', 'tg');
|
||||
$qb->where('tg.id = :id');
|
||||
$qb->setParameter('id', $id);
|
||||
$qb->setMaxResults(1);
|
||||
return $qb->getQuery()->getOneOrNullResult();
|
||||
|
||||
}
|
||||
}
|
||||
134
src/AppBundle/Entity/TravelGuides.php
Normal file
134
src/AppBundle/Entity/TravelGuides.php
Normal file
|
|
@ -0,0 +1,134 @@
|
|||
<?php
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
|
||||
/**
|
||||
* TravelGuides
|
||||
*
|
||||
* @ORM\Table(name="travel_guides")
|
||||
* @ORM\Entity(repositoryClass="AppBundle\Entity\TravelGuideRepository")
|
||||
*/
|
||||
class TravelGuides
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
*
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="name", type="string", length=255)
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="slug", type="string", length=255, unique=true)
|
||||
*/
|
||||
private $slug;
|
||||
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="full_text", type="text", nullable=true)
|
||||
*/
|
||||
private $fullText;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set name
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return CMSContent
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set slug
|
||||
*
|
||||
* @param string $slug
|
||||
*
|
||||
* @return CMSContent
|
||||
*/
|
||||
public function setSlug($slug)
|
||||
{
|
||||
$this->slug = $slug;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get slug
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSlug()
|
||||
{
|
||||
return $this->slug;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set fullText
|
||||
*
|
||||
* @param string $fullText
|
||||
*
|
||||
* @return CMSContent
|
||||
*/
|
||||
public function setFullText($fullText)
|
||||
{
|
||||
$this->fullText = $fullText;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get fullText
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFullText()
|
||||
{
|
||||
return $this->fullText;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
273
src/AppBundle/Entity/TravelInsurance.php
Normal file
273
src/AppBundle/Entity/TravelInsurance.php
Normal file
|
|
@ -0,0 +1,273 @@
|
|||
<?php
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* TravelInsurance
|
||||
*
|
||||
* @ORM\Table(name="travel_insurance")
|
||||
* @ORM\Entity
|
||||
*/
|
||||
class TravelInsurance
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="name", type="string", length=255, nullable=true)
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="internal_name", type="string", length=255, nullable=true)
|
||||
*/
|
||||
private $internalName;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="included", type="text", length=255, nullable=true)
|
||||
*/
|
||||
private $included;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="insurance_name", type="string", length=255, nullable=true)
|
||||
*/
|
||||
private $insuranceName;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="text", type="string", length=255, nullable=true)
|
||||
*/
|
||||
private $text;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="insurance_pdf", type="string", length=255, nullable=true)
|
||||
*/
|
||||
private $insurancePdf;
|
||||
|
||||
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="IDENTITY")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @ORM\OneToMany(targetEntity="AppBundle\Entity\TravelInsurancePrice", mappedBy="insurance")
|
||||
*/
|
||||
protected $prices;
|
||||
|
||||
|
||||
/**
|
||||
* Set name
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return TravelInsurance
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set internalName
|
||||
*
|
||||
* @param string $internalName
|
||||
*
|
||||
* @return TravelInsurance
|
||||
*/
|
||||
public function setInternalName($internalName)
|
||||
{
|
||||
$this->internalName = $internalName;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get internalName
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getInternalName()
|
||||
{
|
||||
return $this->internalName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set insuranceName
|
||||
*
|
||||
* @param string $insuranceName
|
||||
*
|
||||
* @return TravelInsurance
|
||||
*/
|
||||
public function setInsuranceName($insuranceName)
|
||||
{
|
||||
$this->insuranceName = $insuranceName;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get insuranceName
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getInsuranceName()
|
||||
{
|
||||
return $this->insuranceName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set text
|
||||
*
|
||||
* @param string $text
|
||||
*
|
||||
* @return TravelInsurance
|
||||
*/
|
||||
public function setText($text)
|
||||
{
|
||||
$this->text = $text;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get text
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getText()
|
||||
{
|
||||
return $this->text;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set insurancePdf
|
||||
*
|
||||
* @param string $insurancePdf
|
||||
*
|
||||
* @return TravelInsurance
|
||||
*/
|
||||
public function setInsurancePdf($insurancePdf)
|
||||
{
|
||||
$this->insurancePdf = $insurancePdf;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get insurancePdf
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getInsurancePdf()
|
||||
{
|
||||
return $this->insurancePdf;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set included
|
||||
*
|
||||
* @param string $included
|
||||
*
|
||||
* @return TravelInsurance
|
||||
*/
|
||||
public function setIncluded($included)
|
||||
{
|
||||
$this->included = $included;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get included
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getIncluded()
|
||||
{
|
||||
return $this->included;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->prices = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add price
|
||||
*
|
||||
* @param \AppBundle\Entity\TravelInsurancePrice $price
|
||||
*
|
||||
* @return TravelInsurance
|
||||
*/
|
||||
public function addPrice(\AppBundle\Entity\TravelInsurancePrice $price)
|
||||
{
|
||||
$this->prices[] = $price;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove price
|
||||
*
|
||||
* @param \AppBundle\Entity\TravelInsurancePrice $price
|
||||
*/
|
||||
public function removePrice(\AppBundle\Entity\TravelInsurancePrice $price)
|
||||
{
|
||||
$this->prices->removeElement($price);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get prices
|
||||
*
|
||||
* @return TravelInsurancePrice[]|\Doctrine\Common\Collections\Collection
|
||||
*/
|
||||
public function getPrices()
|
||||
{
|
||||
return $this->prices;
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
return $this->getName();
|
||||
}
|
||||
}
|
||||
256
src/AppBundle/Entity/TravelInsurancePrice.php
Normal file
256
src/AppBundle/Entity/TravelInsurancePrice.php
Normal file
|
|
@ -0,0 +1,256 @@
|
|||
<?php
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* TravelInsurancePrice
|
||||
*
|
||||
* @ORM\Table(name="travel_insurance_price", indexes={@ORM\Index(name="FK_travel_insurance_price_travel_insurance", columns={"insurance_id"})})
|
||||
* @ORM\Entity(repositoryClass="AppBundle\Entity\TravelInsurancePriceRepository")
|
||||
*/
|
||||
class TravelInsurancePrice
|
||||
{
|
||||
/**
|
||||
* @var float
|
||||
*
|
||||
* @ORM\Column(name="border", type="float", precision=10, scale=2, nullable=true)
|
||||
*/
|
||||
private $border;
|
||||
|
||||
/**
|
||||
* @var float
|
||||
*
|
||||
* @ORM\Column(name="price", type="float", precision=10, scale=2, nullable=true)
|
||||
*/
|
||||
private $price;
|
||||
|
||||
/**
|
||||
* @var float
|
||||
*
|
||||
* @ORM\Column(name="price_old", type="float", precision=10, scale=2, nullable=true)
|
||||
*/
|
||||
private $price_old;
|
||||
|
||||
/**
|
||||
* @var float
|
||||
*
|
||||
* @ORM\Column(name="percent", type="float", precision=10, scale=2, nullable=true)
|
||||
*/
|
||||
private $percent;
|
||||
|
||||
/**
|
||||
* @var float
|
||||
*
|
||||
* @ORM\Column(name="percent_old", type="float", precision=10, scale=2, nullable=true)
|
||||
*/
|
||||
private $percent_old;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="code", type="string", length=255, nullable=true)
|
||||
*/
|
||||
private $code;
|
||||
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="IDENTITY")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @var \AppBundle\Entity\TravelInsurance
|
||||
*
|
||||
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\TravelInsurance", inversedBy="prices")
|
||||
* @ORM\JoinColumns({
|
||||
* @ORM\JoinColumn(name="insurance_id", referencedColumnName="id")
|
||||
* })
|
||||
*/
|
||||
private $insurance;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Set border
|
||||
*
|
||||
* @param float $border
|
||||
*
|
||||
* @return TravelInsurancePrice
|
||||
*/
|
||||
public function setBorder($border)
|
||||
{
|
||||
$this->border = $border;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get border
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function getBorder()
|
||||
{
|
||||
return $this->border;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set price
|
||||
*
|
||||
* @param float $price
|
||||
*
|
||||
* @return TravelInsurancePrice
|
||||
*/
|
||||
public function setPrice($price)
|
||||
{
|
||||
$this->price = $price;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get price
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function getPrice()
|
||||
{
|
||||
return $this->price;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set price_old
|
||||
*
|
||||
* @param float $price_old
|
||||
*
|
||||
* @return TravelInsurancePrice
|
||||
*/
|
||||
public function setPriceOld($price_old)
|
||||
{
|
||||
$this->price_old = $price_old;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get price_old
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function getPriceOld()
|
||||
{
|
||||
return $this->price_old;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set percent
|
||||
*
|
||||
* @param float $percent
|
||||
*
|
||||
* @return TravelInsurancePrice
|
||||
*/
|
||||
public function setPercent($percent)
|
||||
{
|
||||
$this->percent = $percent;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get percent
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function getPercent()
|
||||
{
|
||||
return $this->percent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set percent_old
|
||||
*
|
||||
* @param float $percent_old
|
||||
*
|
||||
* @return TravelInsurancePrice
|
||||
*/
|
||||
public function setPercentOld($percent_old)
|
||||
{
|
||||
$this->percent_old = $percent_old;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get percent_old
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function getPercentOld()
|
||||
{
|
||||
return $this->percent_old;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set code
|
||||
*
|
||||
* @param string $code
|
||||
*
|
||||
* @return TravelInsurancePrice
|
||||
*/
|
||||
public function setCode($code)
|
||||
{
|
||||
$this->code = $code;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get code
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCode()
|
||||
{
|
||||
return $this->code;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set insurance
|
||||
*
|
||||
* @param \AppBundle\Entity\TravelInsurance $insurance
|
||||
*
|
||||
* @return TravelInsurancePrice
|
||||
*/
|
||||
public function setInsurance(\AppBundle\Entity\TravelInsurance $insurance = null)
|
||||
{
|
||||
$this->insurance = $insurance;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get insurance
|
||||
*
|
||||
* @return \AppBundle\Entity\TravelInsurance
|
||||
*/
|
||||
public function getInsurance()
|
||||
{
|
||||
return $this->insurance;
|
||||
}
|
||||
}
|
||||
32
src/AppBundle/Entity/TravelInsurancePriceRepository.php
Normal file
32
src/AppBundle/Entity/TravelInsurancePriceRepository.php
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
|
||||
/**
|
||||
* TravelInsurancePriceRepository
|
||||
*
|
||||
* This class was generated by the Doctrine ORM. Add your own custom
|
||||
* repository methods below.
|
||||
*/
|
||||
class TravelInsurancePriceRepository extends \Doctrine\ORM\EntityRepository
|
||||
{
|
||||
/**
|
||||
* @param $insuranceId
|
||||
* @param $assessmentBasis
|
||||
*
|
||||
* @return TravelInsurancePrice|null
|
||||
*/
|
||||
public function findOneByInsuranceIdAndAssessmentBasis($insuranceId, $assessmentBasis)
|
||||
{
|
||||
$qb = $this->createQueryBuilder('i');
|
||||
return $qb
|
||||
->where($qb->expr()->eq('IDENTITY(i.insurance)', $insuranceId))
|
||||
//->where('IDENTITY(i.insurance) = '. $insuranceId)
|
||||
->andWhere($qb->expr()->gte('i.border', $assessmentBasis))
|
||||
->orderBy('i.border')
|
||||
->setMaxResults(1)
|
||||
->getQuery()
|
||||
->getOneOrNullResult();
|
||||
}
|
||||
}
|
||||
68
src/AppBundle/Entity/TravelNationality.php
Normal file
68
src/AppBundle/Entity/TravelNationality.php
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
<?php
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* TravelNationality
|
||||
*
|
||||
* @ORM\Table(name="travel_nationality")
|
||||
* @ORM\Entity
|
||||
*/
|
||||
class TravelNationality
|
||||
{
|
||||
/**
|
||||
* @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=true)
|
||||
*/
|
||||
private $name;
|
||||
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set name
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return TravelNationality
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
23
src/AppBundle/Entity/TravelNationalityRepository.php
Normal file
23
src/AppBundle/Entity/TravelNationalityRepository.php
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Query;
|
||||
|
||||
/**
|
||||
* TravelNationalityRepository
|
||||
*/
|
||||
|
||||
class TravelNationalityRepository extends \Doctrine\ORM\EntityRepository
|
||||
{
|
||||
|
||||
public function getAllEntries()
|
||||
{
|
||||
return $this->createQueryBuilder('n')->select('n')->getQuery()->execute();
|
||||
}
|
||||
|
||||
public function getAllEntriesAsArray()
|
||||
{
|
||||
return $this->createQueryBuilder('n')->select('n')->getQuery()->getResult(Query::HYDRATE_ARRAY);
|
||||
}
|
||||
}
|
||||
128
src/AppBundle/Entity/TravelNationalityRequirement.php
Normal file
128
src/AppBundle/Entity/TravelNationalityRequirement.php
Normal file
|
|
@ -0,0 +1,128 @@
|
|||
<?php
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
|
||||
/**
|
||||
* TravelNationalityRequirement
|
||||
* @ORM\Table(name="travel_nationality_requirement")
|
||||
* @ORM\Entity(repositoryClass="AppBundle\Entity\TravelNationalityRequirementRepository")
|
||||
*/
|
||||
class TravelNationalityRequirement
|
||||
{
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="IDENTITY")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* @ORM\Column(name="travel_country_id", type="integer", nullable=true)
|
||||
*/
|
||||
private $travelCountryId;
|
||||
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* @ORM\Column(name="travel_nationality_id", type="integer", nullable=true)
|
||||
*/
|
||||
private $travelNationalityId;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="text", type="text", length=65535, nullable=true)
|
||||
*/
|
||||
private $text;
|
||||
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set travelCountryId
|
||||
*
|
||||
* @param integer $travelCountryId
|
||||
*
|
||||
* @return TravelNationalityRequirement
|
||||
*/
|
||||
public function setTravelCountryId($travelCountryId)
|
||||
{
|
||||
$this->travelCountryId = $travelCountryId;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get travelCountryId
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getTravelCountryId()
|
||||
{
|
||||
return $this->travelCountryId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set travelNationalityId
|
||||
*
|
||||
* @param integer $travelNationalityId
|
||||
*
|
||||
* @return TravelNationalityRequirement
|
||||
*/
|
||||
public function setTravelNationalityId($travelNationalityId)
|
||||
{
|
||||
$this->travelNationalityId = $travelNationalityId;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get travelNationalityId
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getTravelNationalityId()
|
||||
{
|
||||
return $this->travelNationalityId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set text
|
||||
*
|
||||
* @param string $text
|
||||
*
|
||||
* @return TravelNationalityRequirement
|
||||
*/
|
||||
public function setText($text)
|
||||
{
|
||||
$this->text = $text;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get text
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getText()
|
||||
{
|
||||
return $this->text;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
/**
|
||||
* TravelNationalityRequirementRepository
|
||||
*/
|
||||
|
||||
class TravelNationalityRequirementRepository extends \Doctrine\ORM\EntityRepository
|
||||
{
|
||||
|
||||
public function findOneByCountryAndNationality($travel_country_id, $travel_nationality_id)
|
||||
{
|
||||
$qb = $this->createQueryBuilder('nr');
|
||||
return $qb
|
||||
->where('nr.travelCountryId = '.$travel_country_id)
|
||||
->andWhere('nr.travelNationalityId = '.$travel_nationality_id)
|
||||
->setMaxResults(1)
|
||||
->getQuery()
|
||||
->getOneOrNullResult();
|
||||
}
|
||||
}
|
||||
195
src/AppBundle/Entity/TravelOption.php
Normal file
195
src/AppBundle/Entity/TravelOption.php
Normal file
|
|
@ -0,0 +1,195 @@
|
|||
<?php
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* TravelOption
|
||||
*
|
||||
* @ORM\Table(name="travel_option")
|
||||
* @ORM\Entity
|
||||
*/
|
||||
class TravelOption
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="name", type="string", length=255, nullable=true)
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="internal_name", type="string", length=255, nullable=true)
|
||||
*/
|
||||
private $internalName;
|
||||
|
||||
/**
|
||||
* @var float
|
||||
*
|
||||
* @ORM\Column(name="price", type="float", precision=10, scale=2, nullable=true)
|
||||
*/
|
||||
private $price;
|
||||
|
||||
/**
|
||||
* @var float
|
||||
*
|
||||
* @ORM\Column(name="price_children", type="float", precision=10, scale=2, nullable=true)
|
||||
*/
|
||||
private $priceChildren;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="description", type="text", length=65535, nullable=true)
|
||||
*/
|
||||
private $description;
|
||||
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="IDENTITY")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Set name
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return TravelOption
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set internalName
|
||||
*
|
||||
* @param string $internalName
|
||||
*
|
||||
* @return TravelOption
|
||||
*/
|
||||
public function setInternalName($internalName)
|
||||
{
|
||||
$this->internalName = $internalName;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get internalName
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getInternalName()
|
||||
{
|
||||
return $this->internalName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set price
|
||||
*
|
||||
* @param float $price
|
||||
*
|
||||
* @return TravelOption
|
||||
*/
|
||||
public function setPrice($price)
|
||||
{
|
||||
$this->price = $price;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get price
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function getPrice()
|
||||
{
|
||||
return $this->price;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set priceChildren
|
||||
*
|
||||
* @param float $priceChildren
|
||||
*
|
||||
* @return TravelOption
|
||||
*/
|
||||
public function setPriceChildren($priceChildren)
|
||||
{
|
||||
$this->priceChildren = $priceChildren;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get priceChildren
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function getPriceChildren()
|
||||
{
|
||||
return $this->priceChildren;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set description
|
||||
*
|
||||
* @param string $description
|
||||
*
|
||||
* @return TravelOption
|
||||
*/
|
||||
public function setDescription($description)
|
||||
{
|
||||
$this->description = $description;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get description
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDescription()
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
return $this->getName();
|
||||
}
|
||||
}
|
||||
295
src/AppBundle/Entity/TravelOrganizer.php
Normal file
295
src/AppBundle/Entity/TravelOrganizer.php
Normal file
|
|
@ -0,0 +1,295 @@
|
|||
<?php
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* TravelOrganizer
|
||||
*
|
||||
* @ORM\Table(name="travel_organizer")
|
||||
* @ORM\Entity
|
||||
*/
|
||||
class TravelOrganizer
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="name", type="string", length=255, nullable=true)
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="insolvency", type="string", length=255, nullable=true)
|
||||
*/
|
||||
private $insolvency;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="legal_rights", type="text", length=65535, nullable=false)
|
||||
*/
|
||||
private $legalRights;
|
||||
|
||||
/**
|
||||
* @var \DateTime
|
||||
*
|
||||
* @ORM\Column(name="rules_updated", type="date", nullable=true)
|
||||
*/
|
||||
private $rulesUpdated;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="file_name", type="string", length=255, nullable=true)
|
||||
*/
|
||||
private $fileName;
|
||||
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="form_arb", type="string", length=255, nullable=true)
|
||||
*/
|
||||
private $formArb;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="file_form_page", type="string", length=255, nullable=true)
|
||||
*/
|
||||
private $fileFormPage;
|
||||
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* @ORM\Column(name="cms_id", type="integer", nullable=true)
|
||||
*/
|
||||
private $cmsId;
|
||||
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="IDENTITY")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Set name
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return TravelOrganizer
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set insolvency
|
||||
*
|
||||
* @param string $insolvency
|
||||
*
|
||||
* @return TravelOrganizer
|
||||
*/
|
||||
public function setInsolvency($insolvency)
|
||||
{
|
||||
$this->insolvency = $insolvency;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get insolvency
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getInsolvency()
|
||||
{
|
||||
return $this->insolvency;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set legalRights
|
||||
*
|
||||
* @param string $legalRights
|
||||
*
|
||||
* @return TravelOrganizer
|
||||
*/
|
||||
public function setLegalRights($legalRights)
|
||||
{
|
||||
$this->legalRights = $legalRights;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get legalRights
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLegalRights()
|
||||
{
|
||||
return $this->legalRights;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set rulesUpdated
|
||||
*
|
||||
* @param \DateTime $rulesUpdated
|
||||
*
|
||||
* @return TravelOrganizer
|
||||
*/
|
||||
public function setRulesUpdated($rulesUpdated)
|
||||
{
|
||||
$this->rulesUpdated = $rulesUpdated;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get rulesUpdated
|
||||
*
|
||||
* @return \DateTime
|
||||
*/
|
||||
public function getRulesUpdated()
|
||||
{
|
||||
return $this->rulesUpdated;
|
||||
}
|
||||
|
||||
public function getRulesUpdatedTime()
|
||||
{
|
||||
if($this->rulesUpdated){
|
||||
return $this->rulesUpdated->getTimestamp();
|
||||
}
|
||||
return ;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Set fileName
|
||||
*
|
||||
* @param string $fileName
|
||||
*
|
||||
* @return TravelOrganizer
|
||||
*/
|
||||
public function setFileName($fileName)
|
||||
{
|
||||
$this->fileName = $fileName;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get fileName
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFileName()
|
||||
{
|
||||
return $this->fileName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set formArb
|
||||
*
|
||||
* @param string $formArb
|
||||
*
|
||||
* @return TravelOrganizer
|
||||
*/
|
||||
public function setFormArb($formArb)
|
||||
{
|
||||
$this->formArb = $formArb;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get formArb
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFormArb()
|
||||
{
|
||||
return $this->formArb;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set fileFormPage
|
||||
*
|
||||
* @param string $fileFormPage
|
||||
*
|
||||
* @return TravelOrganizer
|
||||
*/
|
||||
public function setFileFormPage($fileFormPage)
|
||||
{
|
||||
$this->fileFormPage = $fileFormPage;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get fileFormPage
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFileFormPage()
|
||||
{
|
||||
return $this->fileFormPage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set cmsId
|
||||
*
|
||||
* @param integer $cmsId
|
||||
*
|
||||
* @return TravelOrganizer
|
||||
*/
|
||||
public function setCmsId($cmsId)
|
||||
{
|
||||
$this->cmsId = $cmsId;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get cmsId
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getCmsId()
|
||||
{
|
||||
return $this->cmsId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
}
|
||||
487
src/AppBundle/Entity/TravelPeriod.php
Normal file
487
src/AppBundle/Entity/TravelPeriod.php
Normal file
|
|
@ -0,0 +1,487 @@
|
|||
<?php
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* TravelPeriod
|
||||
*
|
||||
* @ORM\Table(name="travel_period", indexes={@ORM\Index(name="FK_travel_period_travel_program", columns={"program_id"}), @ORM\Index(name="FK_travel_period_travel_class", columns={"class"}), @ORM\Index(name="FK_travel_period_travel_arrival_point", columns={"travel_arrival_point_id"})})
|
||||
* @ORM\Entity(repositoryClass="AppBundle\Entity\TravelPeriodRepository")
|
||||
*/
|
||||
class TravelPeriod
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="name", type="string", length=255, nullable=true)
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* @var boolean
|
||||
*
|
||||
* @ORM\Column(name="status", type="smallint", nullable=true)
|
||||
*/
|
||||
private $status;
|
||||
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* @ORM\Column(name="order", type="integer", nullable=true)
|
||||
*/
|
||||
private $order;
|
||||
|
||||
/**
|
||||
* @var float
|
||||
*
|
||||
* @ORM\Column(name="price_flight_net", type="float", precision=10, scale=2, nullable=false)
|
||||
*/
|
||||
private $priceFlightNet = '0.00';
|
||||
|
||||
/**
|
||||
* @var boolean
|
||||
*
|
||||
* @ORM\Column(name="is_season", type="boolean", nullable=true)
|
||||
*/
|
||||
private $isSeason = '0';
|
||||
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="IDENTITY")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @var \AppBundle\Entity\TravelArrivalPoint
|
||||
*
|
||||
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\TravelArrivalPoint")
|
||||
* @ORM\JoinColumns({
|
||||
* @ORM\JoinColumn(name="travel_arrival_point_id", referencedColumnName="id")
|
||||
* })
|
||||
*/
|
||||
private $travelArrivalPoint;
|
||||
|
||||
/**
|
||||
* @var \AppBundle\Entity\TravelClass
|
||||
*
|
||||
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\TravelClass")
|
||||
* @ORM\JoinColumns({
|
||||
* @ORM\JoinColumn(name="class", referencedColumnName="id")
|
||||
* })
|
||||
*/
|
||||
private $class;
|
||||
|
||||
/**
|
||||
* @var \AppBundle\Entity\TravelProgram
|
||||
*
|
||||
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\TravelProgram", inversedBy="periods")
|
||||
* @ORM\JoinColumns({
|
||||
* @ORM\JoinColumn(name="program_id", referencedColumnName="id")
|
||||
* })
|
||||
*/
|
||||
private $program;
|
||||
|
||||
/**
|
||||
* @ORM\OneToMany(targetEntity="AppBundle\Entity\TravelPeriodDate", mappedBy="period")
|
||||
*/
|
||||
private $dates;
|
||||
|
||||
/**
|
||||
* @ORM\OneToMany(targetEntity="AppBundle\Entity\TravelDeparturePoint", mappedBy="travelPeriod")
|
||||
*/
|
||||
private $departures;
|
||||
|
||||
/**
|
||||
* @ORM\OneToMany(targetEntity="AppBundle\Entity\TravelPeriodPrice", mappedBy="period", indexBy="priceType")
|
||||
*/
|
||||
private $prices;
|
||||
|
||||
/**
|
||||
* @ORM\OneToMany(targetEntity="AppBundle\Entity\TravelDiscount", mappedBy="period")
|
||||
*/
|
||||
private $discounts;
|
||||
|
||||
/*
|
||||
* @ ORM\OneToOne(targetEntity="AppBundle\Entity\FlightPeriod")
|
||||
* @ ORM\JoinColumns({
|
||||
* @ ORM\JoinColumn(name="")
|
||||
* })
|
||||
*/
|
||||
//private $flightPeriod;
|
||||
|
||||
/**
|
||||
* Set name
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return TravelPeriod
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set status
|
||||
*
|
||||
* @param integer $status
|
||||
*
|
||||
* @return TravelPeriod
|
||||
*/
|
||||
public function setStatus($status)
|
||||
{
|
||||
$this->status = $status;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get status
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getStatus()
|
||||
{
|
||||
return $this->status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set order
|
||||
*
|
||||
* @param integer $order
|
||||
*
|
||||
* @return TravelPeriod
|
||||
*/
|
||||
public function setOrder($order)
|
||||
{
|
||||
$this->order = $order;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get order
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getOrder()
|
||||
{
|
||||
return $this->order;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set priceFlightNet
|
||||
*
|
||||
* @param float $priceFlightNet
|
||||
*
|
||||
* @return TravelPeriod
|
||||
*/
|
||||
public function setPriceFlightNet($priceFlightNet)
|
||||
{
|
||||
$this->priceFlightNet = $priceFlightNet;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get priceFlightNet
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function getPriceFlightNet()
|
||||
{
|
||||
return $this->priceFlightNet;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set isSeason
|
||||
*
|
||||
* @param boolean $isSeason
|
||||
*
|
||||
* @return TravelPeriod
|
||||
*/
|
||||
public function setIsSeason($isSeason)
|
||||
{
|
||||
$this->isSeason = $isSeason;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get isSeason
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getIsSeason()
|
||||
{
|
||||
return $this->isSeason;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set travelArrivalPoint
|
||||
*
|
||||
* @param \AppBundle\Entity\TravelArrivalPoint $travelArrivalPoint
|
||||
*
|
||||
* @return TravelPeriod
|
||||
*/
|
||||
public function setTravelArrivalPoint(\AppBundle\Entity\TravelArrivalPoint $travelArrivalPoint = null)
|
||||
{
|
||||
$this->travelArrivalPoint = $travelArrivalPoint;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get travelArrivalPoint
|
||||
*
|
||||
* @return \AppBundle\Entity\TravelArrivalPoint
|
||||
*/
|
||||
public function getTravelArrivalPoint()
|
||||
{
|
||||
return $this->travelArrivalPoint;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set class
|
||||
*
|
||||
* @param \AppBundle\Entity\TravelClass $class
|
||||
*
|
||||
* @return TravelPeriod
|
||||
*/
|
||||
public function setClass(\AppBundle\Entity\TravelClass $class = null)
|
||||
{
|
||||
$this->class = $class;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get class
|
||||
*
|
||||
* @return \AppBundle\Entity\TravelClass
|
||||
*/
|
||||
public function getClass()
|
||||
{
|
||||
return $this->class;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set program
|
||||
*
|
||||
* @param \AppBundle\Entity\TravelProgram $program
|
||||
*
|
||||
* @return TravelPeriod
|
||||
*/
|
||||
public function setProgram(\AppBundle\Entity\TravelProgram $program = null)
|
||||
{
|
||||
$this->program = $program;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get program
|
||||
*
|
||||
* @return \AppBundle\Entity\TravelProgram
|
||||
*/
|
||||
public function getProgram()
|
||||
{
|
||||
return $this->program;
|
||||
}
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->dates = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add date
|
||||
*
|
||||
* @param \AppBundle\Entity\TravelPeriodDate $date
|
||||
*
|
||||
* @return TravelPeriod
|
||||
*/
|
||||
public function addDate(\AppBundle\Entity\TravelPeriodDate $date)
|
||||
{
|
||||
$this->dates[] = $date;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove date
|
||||
*
|
||||
* @param \AppBundle\Entity\TravelPeriodDate $date
|
||||
*/
|
||||
public function removeDate(\AppBundle\Entity\TravelPeriodDate $date)
|
||||
{
|
||||
$this->dates->removeElement($date);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get dates
|
||||
*
|
||||
* @return \Doctrine\Common\Collections\Collection|TravelPeriodDate[]
|
||||
*/
|
||||
public function getDates()
|
||||
{
|
||||
return $this->dates;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add departure
|
||||
*
|
||||
* @param \AppBundle\Entity\TravelDeparturePoint $departure
|
||||
*
|
||||
* @return TravelPeriod
|
||||
*/
|
||||
public function addDeparture(\AppBundle\Entity\TravelDeparturePoint $departure)
|
||||
{
|
||||
$this->departures[] = $departure;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove departure
|
||||
*
|
||||
* @param \AppBundle\Entity\TravelDeparturePoint $departure
|
||||
*/
|
||||
public function removeDeparture(\AppBundle\Entity\TravelDeparturePoint $departure)
|
||||
{
|
||||
$this->departures->removeElement($departure);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get departures
|
||||
*
|
||||
* @return \Doctrine\Common\Collections\Collection|TravelDeparturePoint[]
|
||||
*/
|
||||
public function getDepartures()
|
||||
{
|
||||
return $this->departures;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add price
|
||||
*
|
||||
* @param \AppBundle\Entity\TravelPeriodPrice $price
|
||||
*
|
||||
* @return TravelPeriod
|
||||
*/
|
||||
public function addPrice(\AppBundle\Entity\TravelPeriodPrice $price)
|
||||
{
|
||||
$this->prices[] = $price;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove price
|
||||
*
|
||||
* @param \AppBundle\Entity\TravelPeriodPrice $price
|
||||
*/
|
||||
public function removePrice(\AppBundle\Entity\TravelPeriodPrice $price)
|
||||
{
|
||||
$this->prices->removeElement($price);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get prices
|
||||
*
|
||||
* @return \Doctrine\Common\Collections\Collection|TravelPeriodPrice[]
|
||||
*/
|
||||
public function getPrices()
|
||||
{
|
||||
return $this->prices;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add discount
|
||||
*
|
||||
* @param \AppBundle\Entity\TravelDiscount $discount
|
||||
*
|
||||
* @return TravelPeriod
|
||||
*/
|
||||
public function addDiscount(\AppBundle\Entity\TravelDiscount $discount)
|
||||
{
|
||||
$this->discounts[] = $discount;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove discount
|
||||
*
|
||||
* @param \AppBundle\Entity\TravelDiscount $discount
|
||||
*/
|
||||
public function removeDiscount(\AppBundle\Entity\TravelDiscount $discount)
|
||||
{
|
||||
$this->discounts->removeElement($discount);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get discounts
|
||||
*
|
||||
* @return \Doctrine\Common\Collections\Collection|TravelDiscount[]
|
||||
*/
|
||||
public function getDiscounts()
|
||||
{
|
||||
return $this->discounts;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \DateTime
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function getStartDate()
|
||||
{
|
||||
if ($this->isSeason)
|
||||
{
|
||||
throw new \Exception('Call to getStartDate() is only allowed for non-seasons');
|
||||
}
|
||||
return $this->getDates()->first()->getStartDate();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \DateTime
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function getEndDate()
|
||||
{
|
||||
if ($this->isSeason)
|
||||
{
|
||||
throw new \Exception('Call to getEndDate() is only allowed for non-seasons');
|
||||
}
|
||||
return $this->getDates()->first()->getEndDate();
|
||||
}
|
||||
}
|
||||
178
src/AppBundle/Entity/TravelPeriodDate.php
Normal file
178
src/AppBundle/Entity/TravelPeriodDate.php
Normal file
|
|
@ -0,0 +1,178 @@
|
|||
<?php
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* TravelPeriodDate
|
||||
*
|
||||
* @ORM\Table(name="travel_period_date", indexes={@ORM\Index(name="FK_travel_period_date_travel_period", columns={"period_id"})})
|
||||
* @ORM\Entity
|
||||
*/
|
||||
class TravelPeriodDate
|
||||
{
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* @ORM\Column(name="year", type="integer", nullable=true)
|
||||
*/
|
||||
private $year;
|
||||
|
||||
/**
|
||||
* @var \DateTime
|
||||
*
|
||||
* @ORM\Column(name="start_date", type="date", nullable=true)
|
||||
*/
|
||||
private $startDate;
|
||||
|
||||
/**
|
||||
* @var \DateTime
|
||||
*
|
||||
* @ORM\Column(name="end_date", type="date", nullable=true)
|
||||
*/
|
||||
private $endDate;
|
||||
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="IDENTITY")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @var \AppBundle\Entity\TravelPeriod
|
||||
*
|
||||
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\TravelPeriod", inversedBy="dates")
|
||||
* @ORM\JoinColumns({
|
||||
* @ORM\JoinColumn(name="", referencedColumnName="")
|
||||
* })
|
||||
*/
|
||||
private $period;
|
||||
|
||||
private $flightPeriod;
|
||||
|
||||
/**
|
||||
* Set year
|
||||
*
|
||||
* @param integer $year
|
||||
*
|
||||
* @return TravelPeriodDate
|
||||
*/
|
||||
public function setYear($year)
|
||||
{
|
||||
$this->year = $year;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get year
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getYear()
|
||||
{
|
||||
return $this->year;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set startDate
|
||||
*
|
||||
* @param \DateTime $startDate
|
||||
*
|
||||
* @return TravelPeriodDate
|
||||
*/
|
||||
public function setStartDate($startDate)
|
||||
{
|
||||
$this->startDate = $startDate;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get startDate
|
||||
*
|
||||
* @return \DateTime
|
||||
*/
|
||||
public function getStartDate()
|
||||
{
|
||||
return $this->startDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set endDate
|
||||
*
|
||||
* @param \DateTime $endDate
|
||||
*
|
||||
* @return TravelPeriodDate
|
||||
*/
|
||||
public function setEndDate($endDate)
|
||||
{
|
||||
$this->endDate = $endDate;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get endDate
|
||||
*
|
||||
* @return \DateTime
|
||||
*/
|
||||
public function getEndDate()
|
||||
{
|
||||
return $this->endDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set period
|
||||
*
|
||||
* @param \AppBundle\Entity\TravelPeriod $period
|
||||
*
|
||||
* @return TravelPeriodDate
|
||||
*/
|
||||
public function setPeriod(\AppBundle\Entity\TravelPeriod $period = null)
|
||||
{
|
||||
$this->period = $period;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get period
|
||||
*
|
||||
* @return \AppBundle\Entity\TravelPeriod
|
||||
*/
|
||||
public function getPeriod()
|
||||
{
|
||||
return $this->period;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getFlightPeriod()
|
||||
{
|
||||
return $this->flightPeriod;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $flightPeriod
|
||||
*/
|
||||
public function setFlightPeriod($flightPeriod)
|
||||
{
|
||||
$this->flightPeriod = $flightPeriod;
|
||||
}
|
||||
}
|
||||
558
src/AppBundle/Entity/TravelPeriodPrice.php
Normal file
558
src/AppBundle/Entity/TravelPeriodPrice.php
Normal file
|
|
@ -0,0 +1,558 @@
|
|||
<?php
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* TravelPeriodPrice
|
||||
*
|
||||
* @ORM\Table(name="travel_period_price", uniqueConstraints={@ORM\UniqueConstraint(name="UK_price_type_period_id", columns={"price_type", "period_id"})}, indexes={@ORM\Index(name="FK_travel_period_price_travel_period", columns={"period_id"})})
|
||||
* @ORM\Entity
|
||||
*/
|
||||
class TravelPeriodPrice
|
||||
{
|
||||
|
||||
/**
|
||||
* @var float
|
||||
*
|
||||
* @ORM\Column(name="price_children", type="float", precision=10, scale=2, nullable=true)
|
||||
*/
|
||||
private $priceChildren;
|
||||
|
||||
/**
|
||||
* @var float
|
||||
*
|
||||
* @ORM\Column(name="price_net", type="float", precision=10, scale=2, nullable=false)
|
||||
*/
|
||||
private $price = '0.00';
|
||||
|
||||
/**
|
||||
* @var float
|
||||
*
|
||||
* @ORM\Column(name="price_comfort_net", type="float", precision=10, scale=2, nullable=false)
|
||||
*/
|
||||
private $priceComfort = '0.00';
|
||||
|
||||
|
||||
/**
|
||||
* @var float
|
||||
*
|
||||
* @ORM\Column(name="extra_price_children", type="float", precision=10, scale=2, nullable=true)
|
||||
*/
|
||||
private $extraPriceChildren;
|
||||
|
||||
/**
|
||||
* @var float
|
||||
*
|
||||
* @ORM\Column(name="extra_price_net", type="float", precision=10, scale=2, nullable=false)
|
||||
*/
|
||||
private $extraPrice = '0.00';
|
||||
|
||||
/**
|
||||
* @var float
|
||||
*
|
||||
* @ORM\Column(name="extra_price_comfort_net", type="float", precision=10, scale=2, nullable=false)
|
||||
*/
|
||||
private $extraPriceComfort = '0.00';
|
||||
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="IDENTITY")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @var \AppBundle\Entity\TravelPeriod
|
||||
*
|
||||
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\TravelPeriod", inversedBy="prices")
|
||||
* @ORM\JoinColumns({
|
||||
* @ORM\JoinColumn(name="period_id", referencedColumnName="id")
|
||||
* })
|
||||
*/
|
||||
private $period;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\TravelPeriodPriceType")
|
||||
* @ORM\JoinColumns({
|
||||
* @ORM\JoinColumn(name="price_type", referencedColumnName="id")
|
||||
* })
|
||||
*/
|
||||
private $priceType;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="integer", nullable=false, name="price_type")
|
||||
*/
|
||||
private $priceTypeId;
|
||||
|
||||
private $effectivePrice = null;
|
||||
private $effectiveChildPrice = null;
|
||||
private $effectiveComfortPrice = null;
|
||||
|
||||
private $effectiveExtraPrice = null;
|
||||
private $effectiveExtraChildPrice = null;
|
||||
private $effectiveExtraComfortPrice = null;
|
||||
|
||||
/**
|
||||
* @ORM\Column(name="available", type="integer", nullable=false)
|
||||
*/
|
||||
private $available;
|
||||
|
||||
/**
|
||||
* Set priceType
|
||||
*
|
||||
* @param integer $priceType
|
||||
*
|
||||
* @return TravelPeriodPrice
|
||||
*/
|
||||
public function setPriceType($priceType)
|
||||
{
|
||||
$this->priceType = $priceType;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get priceType
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getPriceType()
|
||||
{
|
||||
return $this->priceType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set available
|
||||
*
|
||||
* @param integer $available
|
||||
*
|
||||
* @return TravelPeriodPrice
|
||||
*/
|
||||
public function setAvailable($available)
|
||||
{
|
||||
$this->available = $available;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get available
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getAvailable()
|
||||
{
|
||||
return $this->available;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set priceChildren
|
||||
*
|
||||
* @param float $priceChildren
|
||||
*
|
||||
* @return TravelPeriodPrice
|
||||
*/
|
||||
public function setPriceChildren($priceChildren)
|
||||
{
|
||||
$this->priceChildren = $priceChildren;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get priceChildren
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function getPriceChildren()
|
||||
{
|
||||
return $this->priceChildren;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set price
|
||||
*
|
||||
* @param float $price
|
||||
*
|
||||
* @return TravelPeriodPrice
|
||||
*/
|
||||
public function setPrice($price)
|
||||
{
|
||||
$this->price = $price;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get price
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function getPrice()
|
||||
{
|
||||
return $this->price;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set priceComfort
|
||||
*
|
||||
* @param float $priceComfort
|
||||
*
|
||||
* @return TravelPeriodPrice
|
||||
*/
|
||||
public function setPriceComfort($priceComfort)
|
||||
{
|
||||
$this->priceComfort = $priceComfort;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get priceComfort
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function getPriceComfort()
|
||||
{
|
||||
return $this->priceComfort;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set extraPriceChildren
|
||||
*
|
||||
* @param float $extraPriceChildren
|
||||
*
|
||||
* @return TravelPeriodPrice
|
||||
*/
|
||||
public function setExtraPriceChildren($extraPriceChildren)
|
||||
{
|
||||
$this->extraPriceChildren = $extraPriceChildren;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get extraPriceChildren
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function getExtraPriceChildren()
|
||||
{
|
||||
return $this->extraPriceChildren;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set extraPrice
|
||||
*
|
||||
* @param float $extraPrice
|
||||
*
|
||||
* @return TravelPeriodPrice
|
||||
*/
|
||||
public function setExtraPrice($extraPrice)
|
||||
{
|
||||
$this->extraPrice = $extraPrice;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get extraPrice
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function getExtraPrice()
|
||||
{
|
||||
return $this->extraPrice;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set extraPriceComfort
|
||||
*
|
||||
* @param float $extraPriceComfort
|
||||
*
|
||||
* @return TravelPeriodPrice
|
||||
*/
|
||||
public function setExtraPriceComfort($extraPriceComfort)
|
||||
{
|
||||
$this->extraPriceComfort = $extraPriceComfort;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get extraPriceComfort
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function getExtraPriceComfort()
|
||||
{
|
||||
return $this->extraPriceComfort;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set period
|
||||
*
|
||||
* @param \AppBundle\Entity\TravelPeriod $period
|
||||
*
|
||||
* @return TravelPeriodPrice
|
||||
*/
|
||||
public function setPeriod(\AppBundle\Entity\TravelPeriod $period = null)
|
||||
{
|
||||
$this->period = $period;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get period
|
||||
*
|
||||
* @return \AppBundle\Entity\TravelPeriod
|
||||
*/
|
||||
public function getPeriod()
|
||||
{
|
||||
return $this->period;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set priceTypeId
|
||||
*
|
||||
* @param integer $priceTypeId
|
||||
*
|
||||
* @return TravelPeriodPrice
|
||||
*/
|
||||
public function setPriceTypeId($priceTypeId)
|
||||
{
|
||||
$this->priceTypeId = $priceTypeId;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get priceTypeId
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getPriceTypeId()
|
||||
{
|
||||
return $this->priceTypeId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return float
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function getEffectivePrice()
|
||||
{
|
||||
if ($this->effectivePrice === null)
|
||||
{
|
||||
throw new \Exception('Effective price must be set from outside before reading it.');
|
||||
}
|
||||
return $this->effectivePrice;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param float $effectivePrice
|
||||
*/
|
||||
public function setEffectivePrice($effectivePrice)
|
||||
{
|
||||
$this->effectivePrice = $effectivePrice;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return float
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function getEffectiveExtraPrice()
|
||||
{
|
||||
if ($this->effectiveExtraPrice === null)
|
||||
{
|
||||
throw new \Exception('EffectiveExtra price must be set from outside before reading it.');
|
||||
}
|
||||
return $this->effectiveExtraPrice;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param float $effectiveExtraPrice
|
||||
*/
|
||||
public function setEffectiveExtraPrice($effectiveExtraPrice)
|
||||
{
|
||||
$this->effectiveExtraPrice = $effectiveExtraPrice;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Probably getEffectiveDiscountPrice() is the method you are actually looking for.
|
||||
* @return float|null
|
||||
*/
|
||||
public function getDiscountPrice()
|
||||
{
|
||||
return $this->calculateDiscountPrice($this->price);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Probably getEffectiveDiscountPrice() is the method you are actually looking for.
|
||||
* @return float|null
|
||||
*/
|
||||
public function getChildDiscountPrice()
|
||||
{
|
||||
return $this->calculateDiscountPrice($this->priceChildren);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return float
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function getEffectiveDiscountPrice()
|
||||
{
|
||||
if ($this->effectivePrice === null)
|
||||
{
|
||||
throw new \Exception('Effective price must be set from outside before reading effective discount price.');
|
||||
}
|
||||
return $this->calculateDiscountPrice($this->effectivePrice);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return float
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function getEffectiveChildDiscountPrice()
|
||||
{
|
||||
if ($this->effectiveChildPrice === null)
|
||||
{
|
||||
throw new \Exception('Effective price must be set from outside before reading effective discount price.');
|
||||
}
|
||||
return $this->calculateDiscountPrice($this->effectiveChildPrice);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return float
|
||||
* @throws \Exception
|
||||
*
|
||||
* @todo The child price will not be set yet. This is just a preparation for later
|
||||
*/
|
||||
public function getEffectiveChildPrice()
|
||||
{
|
||||
if ($this->effectiveChildPrice === null)
|
||||
{
|
||||
throw new \Exception('Effective child price must be set from outside before reading it.');
|
||||
}
|
||||
return $this->effectiveChildPrice;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param null $effectiveChildPrice
|
||||
*/
|
||||
public function setEffectiveChildPrice($effectiveChildPrice)
|
||||
{
|
||||
$this->effectiveChildPrice = $effectiveChildPrice;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return float
|
||||
* @throws \Exception
|
||||
*
|
||||
* @todo The child price will not be set yet. This is just a preparation for later
|
||||
*/
|
||||
public function getEffectiveExtraChildPrice()
|
||||
{
|
||||
if ($this->effectiveExtraChildPrice === null)
|
||||
{
|
||||
throw new \Exception('Effective Extra child price must be set from outside before reading it.');
|
||||
}
|
||||
return $this->effectiveExtraChildPrice;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param null $effectiveChildPrice
|
||||
*/
|
||||
public function setEffectiveExtraChildPrice($effectiveExtraChildPrice)
|
||||
{
|
||||
$this->effectiveExtraChildPrice = $effectiveExtraChildPrice;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return float|null
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function getEffectiveComfortPrice()
|
||||
{
|
||||
if ($this->effectiveComfortPrice === null)
|
||||
{
|
||||
throw new \Exception('Effective comfort price must be set from outside before reading it.');
|
||||
}
|
||||
return $this->effectiveComfortPrice;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param float|null $effectiveComfortPrice
|
||||
*/
|
||||
public function setEffectiveComfortPrice($effectiveComfortPrice)
|
||||
{
|
||||
$this->effectiveComfortPrice = $effectiveComfortPrice;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return float|null
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function getEffectiveExtraComfortPrice()
|
||||
{
|
||||
if ($this->effectiveExtraComfortPrice === null)
|
||||
{
|
||||
throw new \Exception('Effective Extra comfort price must be set from outside before reading it.');
|
||||
}
|
||||
return $this->effectiveExtraComfortPrice;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param float|null $effectiveExtraComfortPrice
|
||||
*/
|
||||
public function setEffectiveExtraComfortPrice($effectiveExtraComfortPrice)
|
||||
{
|
||||
$this->effectiveExtraComfortPrice = $effectiveExtraComfortPrice;
|
||||
}
|
||||
|
||||
|
||||
private function calculateDiscountPrice($price)
|
||||
{
|
||||
if ($this->getPeriod() == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
$newPrice = $price;
|
||||
foreach ($this->getPeriod()->getDiscounts() as $discount)
|
||||
{
|
||||
$newPrice -= $discount->getPercent()
|
||||
? round($newPrice * $discount->getValue() / 100, 2) // #TODO FIXME
|
||||
: $discount->getValue();
|
||||
}
|
||||
$program = $this->getPeriod()->getProgram();
|
||||
if ($program != null && $program->getDiscount() != null)
|
||||
{
|
||||
$newPrice -= $program->getDiscountIsPercentValue()
|
||||
? round($price * $program->getDiscount() / 100, 2) // #TODO FIXME
|
||||
: $program->getDiscount();
|
||||
}
|
||||
return $price == $newPrice ? null : $newPrice;
|
||||
}
|
||||
}
|
||||
252
src/AppBundle/Entity/TravelPeriodPriceType.php
Normal file
252
src/AppBundle/Entity/TravelPeriodPriceType.php
Normal file
|
|
@ -0,0 +1,252 @@
|
|||
<?php
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* TravelPeriodPriceType
|
||||
*
|
||||
* @ORM\Table(name="travel_period_price_type")
|
||||
* @ORM\Entity(repositoryClass="AppBundle\Entity\TravelPeriodPriceTypeRepository")
|
||||
*/
|
||||
class TravelPeriodPriceType
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="name", type="string", length=255, nullable=true)
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="internal_name", type="string", length=255, nullable=true)
|
||||
*/
|
||||
private $internalName;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="short", type="string", length=255, nullable=true)
|
||||
*/
|
||||
private $short;
|
||||
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* @ORM\Column(name="max", type="integer", nullable=true)
|
||||
*/
|
||||
private $max;
|
||||
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* @ORM\Column(name="min_adults", type="integer", nullable=true)
|
||||
*/
|
||||
private $minAdults;
|
||||
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* @ORM\Column(name="max_adults", type="integer", nullable=true)
|
||||
*/
|
||||
private $maxAdults;
|
||||
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* @ORM\Column(name="max_children", type="integer", nullable=true)
|
||||
*/
|
||||
private $maxChildren;
|
||||
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="IDENTITY")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Set name
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return TravelPeriodPriceType
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set internalName
|
||||
*
|
||||
* @param string $internalName
|
||||
*
|
||||
* @return TravelPeriodPriceType
|
||||
*/
|
||||
public function setInternalName($internalName)
|
||||
{
|
||||
$this->internalName = $internalName;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get internalName
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getInternalName()
|
||||
{
|
||||
return $this->internalName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set short
|
||||
*
|
||||
* @param string $short
|
||||
*
|
||||
* @return TravelPeriodPriceType
|
||||
*/
|
||||
public function setShort($short)
|
||||
{
|
||||
$this->short = $short;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get short
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getShort()
|
||||
{
|
||||
return $this->short;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set max
|
||||
*
|
||||
* @param integer $max
|
||||
*
|
||||
* @return TravelPeriodPriceType
|
||||
*/
|
||||
public function setMax($max)
|
||||
{
|
||||
$this->max = $max;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get max
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getMax()
|
||||
{
|
||||
return $this->max;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set minAdults
|
||||
*
|
||||
* @param integer $minAdults
|
||||
*
|
||||
* @return TravelPeriodPriceType
|
||||
*/
|
||||
public function setMinAdults($minAdults)
|
||||
{
|
||||
$this->minAdults = $minAdults;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get minAdults
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getMinAdults()
|
||||
{
|
||||
return $this->minAdults;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set maxAdults
|
||||
*
|
||||
* @param integer $maxAdults
|
||||
*
|
||||
* @return TravelPeriodPriceType
|
||||
*/
|
||||
public function setMaxAdults($maxAdults)
|
||||
{
|
||||
$this->maxAdults = $maxAdults;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get maxAdults
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getMaxAdults()
|
||||
{
|
||||
return $this->maxAdults;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set maxChildren
|
||||
*
|
||||
* @param integer $maxChildren
|
||||
*
|
||||
* @return TravelPeriodPriceType
|
||||
*/
|
||||
public function setMaxChildren($maxChildren)
|
||||
{
|
||||
$this->maxChildren = $maxChildren;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get maxChildren
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getMaxChildren()
|
||||
{
|
||||
return $this->maxChildren;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
}
|
||||
20
src/AppBundle/Entity/TravelPeriodPriceTypeRepository.php
Normal file
20
src/AppBundle/Entity/TravelPeriodPriceTypeRepository.php
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
/**
|
||||
* TravelPeriodPriceTypeRepository
|
||||
*
|
||||
* This class was generated by the Doctrine ORM. Add your own custom
|
||||
* repository methods below.
|
||||
*/
|
||||
class TravelPeriodPriceTypeRepository extends \Doctrine\ORM\EntityRepository
|
||||
{
|
||||
/**
|
||||
* @return TravelPeriodPriceType[]
|
||||
*/
|
||||
public function findAllIndexedById()
|
||||
{
|
||||
return $this->createQueryBuilder('p', 'p.id')->select('p')->getQuery()->execute();
|
||||
}
|
||||
}
|
||||
514
src/AppBundle/Entity/TravelPeriodRepository.php
Normal file
514
src/AppBundle/Entity/TravelPeriodRepository.php
Normal file
|
|
@ -0,0 +1,514 @@
|
|||
<?php
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
use AppBundle\Util;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\Mapping\ClassMetadata;
|
||||
use Doctrine\ORM\PersistentCollection;
|
||||
use Doctrine\ORM\Query\Expr;
|
||||
|
||||
class TravelPeriodRepository extends \Doctrine\ORM\EntityRepository
|
||||
{
|
||||
private $departureRepository;
|
||||
|
||||
function __construct(EntityManager $em, ClassMetadata $class)
|
||||
{
|
||||
parent::__construct($em, $class);
|
||||
$this->departureRepository = $this->getEntityManager()->getRepository('AppBundle:TravelDeparturePoint');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \DateTime $startDate
|
||||
* @param \DateTime $endDate
|
||||
* @param null $destinationIds
|
||||
* @param bool $combi
|
||||
*
|
||||
* @return TravelProgram[]|array
|
||||
* @throws \Exception
|
||||
* @internal param null $destination
|
||||
*/
|
||||
public function getTravelProgramsWithTravelDatesForTimePeriod($startDate, $endDate, $destinationIds = null,
|
||||
$combi = false)
|
||||
{
|
||||
// Idea for natural sort problem:
|
||||
// Add new column sortable_name
|
||||
|
||||
$now = new \DateTime();
|
||||
if ($startDate < $now)
|
||||
{
|
||||
$startDate = $now;
|
||||
}
|
||||
$startDateStr = $startDate->format('Y-m-d');
|
||||
if ($endDate)
|
||||
{
|
||||
$endDateStr = $endDate->format('Y-m-d');
|
||||
}
|
||||
|
||||
$qb = $this->getEntityManager()->createQueryBuilder()
|
||||
->from('AppBundle:TravelProgram', 'tp', 'tp.id')
|
||||
->addSelect('tp')
|
||||
->where('tp.status > 0');
|
||||
|
||||
// Limit time period for seasons and travel dates
|
||||
$qb->innerJoin('tp.periods', 'p');
|
||||
$qb->addSelect('p');
|
||||
|
||||
$qb->innerJoin('p.dates', 'd');
|
||||
$qb->addSelect('d');
|
||||
$qb->andWhere("((p.isSeason = 0 AND d.startDate >= '$startDateStr' AND d.endDate <= '$endDateStr') OR".
|
||||
" (p.isSeason = 1 AND d.endDate >= '$startDateStr' AND".
|
||||
" DATE_ADD(d.startDate, tp.programDuration, 'DAY') <= '$endDateStr' AND p.status > 0))");
|
||||
|
||||
|
||||
// Prices
|
||||
// Instead of a single join to prices we add one join per price type. This reduces the execution time by
|
||||
// 150ms on the development system
|
||||
$priceTypes = $this->getEntityManager()->getRepository('AppBundle:TravelPeriodPriceType')->findAll();
|
||||
foreach ($priceTypes as $priceType)
|
||||
{
|
||||
$priceTypeKey = 'price_'. $priceType->getId();
|
||||
$qb->leftJoin('p.prices', $priceTypeKey, Expr\Join::WITH,
|
||||
$priceTypeKey .'.priceType = '. $priceType->getId(), $priceTypeKey .'.priceTypeId');
|
||||
$qb->addSelect($priceTypeKey);
|
||||
}
|
||||
$qb->leftJoin('p.discounts', 'discount');
|
||||
$qb->addSelect('discount');
|
||||
|
||||
$qb->leftJoin('p.departures', 'p_dep', Expr\Join::WITH, 'tp.programType = '.
|
||||
TravelProgram::MEDIATED_PROGRAM_TYPE);
|
||||
$qb->addSelect('p_dep');
|
||||
|
||||
// Destinations
|
||||
if (!empty($destinationIds) && is_array($destinationIds))
|
||||
{
|
||||
//$qb->innerJoin('AppBundle:TravelProgramCountry', 'tpc', Expr\Join::WITH,
|
||||
// 'tpc.program = tp AND IDENTITY(tpc.country) IN ('. implode(', ', $destinationIds) .')');
|
||||
$qb->innerJoin('tp.countries', 'tc', Expr\Join::WITH,
|
||||
'tc.id IN ('. implode(', ', $destinationIds) .')');
|
||||
if ($combi)
|
||||
{
|
||||
//$qb->having('COUNT(DISTINCT tpc.country) = '. count($destinationIds));
|
||||
$qb->having('COUNT(DISTINCT tc) = '. count($destinationIds));
|
||||
}
|
||||
}
|
||||
// TODO $qb->groupBy('p.id, p_dep.id, d.id');
|
||||
// $qb->groupBy('p.id');
|
||||
|
||||
// Travel class
|
||||
$qb->innerJoin('p.class', 'cls', Expr\Join::WITH, 'cls.standard = 1');
|
||||
|
||||
// Image
|
||||
$qb->leftJoin('tp.images', 'tp_image', Expr\Join::WITH, 'tp_image.type = 2')
|
||||
->addSelect('tp_image');
|
||||
|
||||
// Sort travel programs
|
||||
|
||||
// $qb->addSelect('COALESCE(tp.position, 0) as HIDDEN position_sort_key');
|
||||
// $qb->orderBy('position_sort_key');
|
||||
|
||||
//$qb->addOrderBy('LENGTH(tp.title)'); // Emulate natural sort
|
||||
$qb->addOrderBy('tp.title');
|
||||
$qb->addOrderBy('tp.id');
|
||||
// Sort: Real travel dates have higher priority than virtual travel dates. Sort travel programs
|
||||
$qb->addOrderBy('p.isSeason, p.id');
|
||||
|
||||
/** @var TravelProgram[]|array $travelPrograms */
|
||||
$travelPrograms = $qb->getQuery()->getResult();
|
||||
|
||||
|
||||
if (empty($travelPrograms))
|
||||
{
|
||||
return $travelPrograms;
|
||||
}
|
||||
// Collect arrival point IDs for non mediated travel programs
|
||||
$isUsedArrivalPointById = [];
|
||||
foreach ($travelPrograms as $travelProgram)
|
||||
{
|
||||
$isUsedTravelProgramById[$travelProgram->getId()] = true;
|
||||
if (!$travelProgram->getIsMediated())
|
||||
{
|
||||
$isUsedArrivalPointById[$travelProgram->getTravelArrivalPoint()->getId()] = true;
|
||||
}
|
||||
}
|
||||
$usedArrivalPointIds = array_keys($isUsedArrivalPointById);
|
||||
|
||||
// Find flight periods and related departures
|
||||
$flightPeriods = empty($isUsedArrivalPointById) ? []
|
||||
: $this->getEntityManager()->getRepository('AppBundle:FlightPeriod')
|
||||
->getIndexedFlightPeriodsForTimePeriod($startDate, $endDate, $usedArrivalPointIds);
|
||||
|
||||
// Find default departures and classify by-program or by-arrival-point
|
||||
// We could've simply left joined them to get an equal result. But we're reducing the number of rows returned
|
||||
// in the first travel program query above drastically with this solution. This doesn't hurt performance.
|
||||
// Of course, we have to link departures of travel programs manually later.
|
||||
$defDepsByArrivalPointId = [];
|
||||
$qb = $this->getEntityManager()->createQueryBuilder()
|
||||
->from('AppBundle:TravelDeparturePoint', 'dep')
|
||||
->addSelect('dep')
|
||||
->where($qb->expr()->in('IDENTITY(dep.program)', array_keys($travelPrograms)));
|
||||
if (!empty($isUsedArrivalPointById))
|
||||
{
|
||||
$qb->orWhere($qb->expr()->in('IDENTITY(dep.travelArrivalPoint)', $usedArrivalPointIds));
|
||||
}
|
||||
/** @var TravelDeparturePoint[]|array $defaultDepartures */
|
||||
$defaultDepartures = $qb->getQuery()->execute();
|
||||
foreach ($defaultDepartures as $defaultDeparture)
|
||||
{
|
||||
if ($defaultDeparture->getProgram())
|
||||
{
|
||||
$travelProgram = $travelPrograms[$defaultDeparture->getProgram()->getId()];
|
||||
if ($travelProgram->getDepartures() instanceof PersistentCollection)
|
||||
{
|
||||
Util::reAttachRelatedCollection($travelProgram, 'departures', $travelProgram->getDepartures()->unwrap());
|
||||
}
|
||||
$travelProgram->addDeparture($defaultDeparture);
|
||||
}
|
||||
elseif ($defaultDeparture->getTravelArrivalPoint())
|
||||
{
|
||||
if (!isset($defDepsByArrivalPointId[$defaultDeparture->getTravelArrivalPoint()->getId()]))
|
||||
{
|
||||
$defDepsByArrivalPointId[$defaultDeparture->getTravelArrivalPoint()->getId()] = [];
|
||||
}
|
||||
$defDepsByArrivalPointId[$defaultDeparture->getTravelArrivalPoint()->getId()][] = $defaultDeparture;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($travelPrograms as $k => $travelProgram)
|
||||
{
|
||||
$flightPeriod = null;
|
||||
if (!$travelProgram->getIsMediated())
|
||||
{
|
||||
$arrivalPointId = $travelProgram->getTravelArrivalPoint()->getId();
|
||||
// Manually link separately fetched default departures
|
||||
$travelProgram->getTravelArrivalPoint()->__setDepartures(
|
||||
isset($defDepsByArrivalPointId[$arrivalPointId])
|
||||
? $defDepsByArrivalPointId[$arrivalPointId]
|
||||
: []
|
||||
);
|
||||
}
|
||||
|
||||
$this->addTravelDatesToProgram($travelProgram, $travelProgram->getPeriods(), $flightPeriods,
|
||||
$startDate, $endDate);
|
||||
|
||||
if (!$travelProgram->hasTravelDates())
|
||||
{
|
||||
unset($travelPrograms[$k]);
|
||||
}
|
||||
}
|
||||
|
||||
return $travelPrograms;
|
||||
}
|
||||
|
||||
private function createTravelDateKey(\DateTime $startDate, \DateTime $endDate)
|
||||
{
|
||||
return $startDate->format('Y-m-d') . $endDate->format('Y-m-d');
|
||||
}
|
||||
|
||||
const TD_QUERY_NON_VIRTUAL = 0x1;
|
||||
const TD_QUERY_VIRTUAL = 0x2;
|
||||
const TD_QUERY_INACTIVE = 0x4;
|
||||
const TD_QUERY_OUTDATED = 0x8;
|
||||
const TD_QUERY_ACP = self::TD_QUERY_INACTIVE | self::TD_QUERY_OUTDATED;
|
||||
const TD_QUERY_VIRTUAL_AND_NON_VIRTUAL = self::TD_QUERY_VIRTUAL | self::TD_QUERY_NON_VIRTUAL;
|
||||
|
||||
/**
|
||||
* @param TravelProgram $program
|
||||
* @param bool $class
|
||||
* @param int $flags
|
||||
*
|
||||
* @return TravelDate[]|array
|
||||
* @todo Find a more appropriate name for this method
|
||||
*/
|
||||
public function getTrueTravelPeriods(TravelProgram $program, $class = false, $flags =
|
||||
self::TD_QUERY_VIRTUAL_AND_NON_VIRTUAL)
|
||||
{
|
||||
if (!($flags & self::TD_QUERY_VIRTUAL_AND_NON_VIRTUAL))
|
||||
{
|
||||
return [];
|
||||
}
|
||||
$doQueryVirtualAndNonVirtual = $flags & self::TD_QUERY_VIRTUAL_AND_NON_VIRTUAL ==
|
||||
self::TD_QUERY_VIRTUAL_AND_NON_VIRTUAL;
|
||||
|
||||
|
||||
/** @var TravelPeriod[] $periods */
|
||||
$qb = $this->createQueryBuilder('p');
|
||||
$qb
|
||||
//->from('AppBundle:TravelPeriod', 'tpp', 'key')
|
||||
->leftJoin('p.dates', 'd')->addSelect('d')
|
||||
->leftJoin('p.prices', 'price', null, null, 'price.priceTypeId')
|
||||
//->innerJoin('price.priceType', 'price_type_')
|
||||
->addSelect('price')
|
||||
->leftJoin('p.discounts', 'discount', Expr\Join::WITH,
|
||||
'discount.start <= CURRENT_TIMESTAMP() AND discount.end >= CURRENT_TIMESTAMP()')->addSelect('discount')
|
||||
->where('IDENTITY(p.program) = '. $program->getId())
|
||||
;
|
||||
|
||||
if ($program->getIsMediated())
|
||||
{
|
||||
// Only mediated travel programs define departures in travelPeriods
|
||||
$qb->leftJoin('p.departures', 'p_dep')->addSelect('p_dep');
|
||||
}
|
||||
elseif (!($flags & self::TD_QUERY_VIRTUAL))
|
||||
{
|
||||
// Retrieving all flight periods by join is only possible, if virtual entries are excluded
|
||||
$qb->leftJoin('AppBundle:FlightPeriod', 'fp', Expr\Join::WITH, 'IDENTITY(fp.travelArrivalPoint) = '.
|
||||
':travelArrivalPointId AND d.startDate = fp.startDate AND d.endDate = fp.endDate');
|
||||
$qb->setParameter('travelArrivalPointId', $program->getTravelArrivalPoint()->getId());
|
||||
$qb->addSelect('fp');
|
||||
$qb->leftJoin('fp.departures', 'fp_dep')->addSelect('fp_dep');
|
||||
}
|
||||
|
||||
$startDate = null;
|
||||
if (!($flags & self::TD_QUERY_OUTDATED))
|
||||
{
|
||||
$startDate = new \DateTime('tomorrow');
|
||||
|
||||
}
|
||||
if ($class)
|
||||
{
|
||||
$qb->andWhere($qb->expr()->eq('IDENTITY(tpp.class)', $class));
|
||||
}
|
||||
|
||||
if ($doQueryVirtualAndNonVirtual)
|
||||
{
|
||||
$qb->addOrderBy('p.isSeason');
|
||||
}
|
||||
else
|
||||
{
|
||||
$qb->andWhere($qb->expr()->eq('p.isSeason', $flags & self::TD_QUERY_VIRTUAL));
|
||||
|
||||
if(!($flags & self::TD_QUERY_INACTIVE))
|
||||
{
|
||||
// If both, non virtual and virtual entries are selected, we cannot exclude inactive entries, because
|
||||
// there may be a non virtual travel date with inactive status and a matching virtual travel date with
|
||||
// active status. In this case, the inactive status would get lost and the virtual travel date would
|
||||
// wrongly be included in the result. Therefore we are removing inactive travel dates later in the
|
||||
// TD_QUERY_VIRTUAL_AND_NON_VIRTUAL case.
|
||||
$qb->andWhere($qb->expr()->gt('tpp.status', 0));
|
||||
}
|
||||
}
|
||||
|
||||
$qb
|
||||
->addOrderBy('p.order', 'ASC')
|
||||
->addOrderBy('d.startDate', 'ASC')
|
||||
->addOrderBy('p.name', 'ASC')
|
||||
;
|
||||
|
||||
$entities = $qb->getQuery()->execute();
|
||||
|
||||
$flightPeriodByKey = null;
|
||||
if (!$program->getIsMediated())
|
||||
{
|
||||
if (!$program->getTravelArrivalPoint())
|
||||
{
|
||||
return [];
|
||||
}
|
||||
if ($flags & self::TD_QUERY_VIRTUAL)
|
||||
{
|
||||
// If virtual entries are included, we have to fetch all flight periods, because we don't know
|
||||
// the actual dates yet
|
||||
$flightPeriodByKey = $this->getEntityManager()->getRepository('AppBundle:FlightPeriod')
|
||||
->getIndexedFlightPeriodsForTimePeriod($startDate, null, $program->getTravelArrivalPoint()->getId());
|
||||
}
|
||||
|
||||
foreach ($entities as $key => $entity)
|
||||
{
|
||||
if ($entity == null)
|
||||
{
|
||||
unset($entities[$key]);
|
||||
}
|
||||
else if ($entity instanceof FlightPeriod)
|
||||
{
|
||||
// We are joining to flight period with multiple keys. Doctrine cannot handle this and returns a
|
||||
// mixed list containing both, travel and flight periods at the same level. We fix that here.
|
||||
$flightPeriodByKey[$entity->getStartDate()->format('Y-m-d') .'_'.
|
||||
$entity->getEndDate()->format('Y-m-d')] = $entity;
|
||||
unset($entities[$key]);
|
||||
}
|
||||
}
|
||||
/** @var TravelPeriod $period */
|
||||
foreach ($entities as &$period)
|
||||
{
|
||||
foreach ($period->getDates() as &$date)
|
||||
{
|
||||
$fpKey = $date->getStartDate()->format('Y-m-d') . $date->getEndDate()->format('Y-m-d') .
|
||||
$program->getTravelArrivalPoint()->getId();
|
||||
if (isset($flightPeriodByKey[$fpKey]))
|
||||
{
|
||||
// #TODO Does this cause performance problems?
|
||||
$date->setFlightPeriod($flightPeriodByKey[$fpKey]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->addTravelDatesToProgram($program, $entities, $flightPeriodByKey, $startDate, null);
|
||||
return $program->getTravelDates();
|
||||
}
|
||||
|
||||
private $currencyFactor = null;
|
||||
|
||||
public function getCurrencyFactor()
|
||||
{
|
||||
if ($this->currencyFactor == null)
|
||||
{
|
||||
// #TODO Enable doctrine 2nd level cache instead of implementing own caching mechanism
|
||||
$dollar = $this->getEntityManager()->getRepository('AppBundle:TravelSetting')->findOneBy(['key' => 'dollar']);
|
||||
if (!$dollar)
|
||||
{
|
||||
throw new \Exception('Missing currency factor setting "dollar" in table travel_setting');
|
||||
}
|
||||
$this->currencyFactor = $dollar->getValue() ?? 1;
|
||||
}
|
||||
return $this->currencyFactor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param TravelProgram $travelProgram
|
||||
* @param array|TravelPeriod[] $travelPeriods Represent seasons and travel dates
|
||||
* @param array|FlightPeriod[] $flightPeriods For performance reasons, $flightPeriods must be pre-fetched
|
||||
* @param \DateTime|null $startDate If not null, only add travel dates later than this value
|
||||
* @param \DateTime|null $endDate If not null, only add travel dates earlier than this value
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function addTravelDatesToProgram(TravelProgram &$travelProgram, $travelPeriods, $flightPeriods,
|
||||
\DateTime $startDate = null, \DateTime $endDate = null)
|
||||
{
|
||||
$currencyFactor = $travelProgram->getNettoPricesInEuro() ? 1 : $this->getCurrencyFactor();
|
||||
$counters = array();
|
||||
|
||||
// #TODO Consider adding travelPeriods to travelProgram in the search algorithm
|
||||
//foreach ($travelProgram->getPeriods() as $travelPeriod)
|
||||
foreach ($travelPeriods as $travelPeriod)
|
||||
{
|
||||
if ($travelPeriod->getIsSeason())
|
||||
{
|
||||
foreach ($travelPeriod->getDates() as $travelPeriodDate)
|
||||
{
|
||||
$cn = $travelPeriodDate->getId().$travelPeriod->getName();
|
||||
if(empty($counters[$cn])){
|
||||
$counters[$cn] = 1;
|
||||
}
|
||||
|
||||
$seasonEndDate = clone $travelPeriodDate->getEndDate();
|
||||
$seasonEndDate->modify('+'.$travelProgram->getProgramDuration().' day');
|
||||
if ($endDate != null && $seasonEndDate > $endDate)
|
||||
{
|
||||
// Limit end date to requested latest travel end date
|
||||
$seasonEndDate = clone $endDate;
|
||||
}
|
||||
// Subtract temporarily added days which were added above. (Also subtract if date was limited!)
|
||||
// Add one day to include season end date in $dates array below (would be excluded otherwise)
|
||||
$seasonEndDate->modify('-'. ($travelProgram->getProgramDuration() - 1) .' day');
|
||||
|
||||
$dates = new \DatePeriod($travelPeriodDate->getStartDate(),
|
||||
\DateInterval::createFromDateString('1 day'), $seasonEndDate);
|
||||
|
||||
$doTestStartDate = $startDate != null;
|
||||
/** @var \DateTime $date */
|
||||
foreach ($dates as $date)
|
||||
{
|
||||
$isPossibleDate = $travelProgram->getIsAvailWeekday($date->format('w'));
|
||||
|
||||
// $doTestStartDate helps to improve performance by avoiding unnecessary (more expensive)
|
||||
// "$date < $startDate" checks: As soon as $date >= $startDate the first time, it will stay
|
||||
// this way until the foreach iteration has finished.
|
||||
if (!($doTestStartDate && $date < $startDate))
|
||||
{
|
||||
$doTestStartDate = false;
|
||||
if ($isPossibleDate)
|
||||
{
|
||||
|
||||
// #TODO Do we need the travel date key?
|
||||
$travelDateEnd = (clone $date)->modify('+'.$travelProgram->getProgramDuration().' day');
|
||||
$travelDateKey = $this->createTravelDateKey($date, $travelDateEnd);
|
||||
|
||||
if (!$travelProgram->hasTravelDate($travelDateKey))
|
||||
{
|
||||
$flightPeriod = null;
|
||||
if (!$travelProgram->getIsMediated())
|
||||
{
|
||||
$flightPeriodKey = $travelDateKey .
|
||||
$travelProgram->getTravelArrivalPoint()->getId();
|
||||
$flightPeriod = $flightPeriods[$flightPeriodKey] ?? null;
|
||||
}
|
||||
$travelProgram->addTravelDateFromSeasonTravelPeriod(
|
||||
$travelDateKey,
|
||||
$travelPeriod,
|
||||
$travelPeriodDate->getId() . $travelPeriod->getName() . $counters[$cn],
|
||||
$date,
|
||||
$travelDateEnd,
|
||||
$flightPeriod,
|
||||
$currencyFactor
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Also increment $i if the date is theoretically possible but excluded from the search request
|
||||
if ($isPossibleDate)
|
||||
{
|
||||
++ $counters[$cn];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif (count($travelPeriod->getDates()) && $travelProgram->getIsPossibleStartDate($travelPeriod->getStartDate()))
|
||||
{
|
||||
$travelDateKey = $this->createTravelDateKey($travelPeriod->getStartDate(), $travelPeriod->getEndDate());
|
||||
$flightPeriod = null;
|
||||
if (!$travelProgram->getIsMediated())
|
||||
{
|
||||
$flightPeriod = $flightPeriods[$travelDateKey . $travelProgram->getTravelArrivalPoint()->getId()]
|
||||
?? null;
|
||||
}
|
||||
|
||||
// #TODO There is an error in the old backend which causes duplicates
|
||||
if ($travelProgram->hasTravelDate($travelDateKey) &&
|
||||
$travelProgram->getTravelDate($travelDateKey)->__getTravelPeriod()->getId() != $travelPeriod->getId())
|
||||
{
|
||||
global $kernel;
|
||||
if($kernel instanceOf \AppCache) $kernel = $kernel->getKernel();
|
||||
$kernel->getContainer()->get('logger')->warn('Duplicate travel period found with name "'.
|
||||
$travelPeriod->getName() .'"');
|
||||
}
|
||||
else
|
||||
{
|
||||
$TravelDate = $travelProgram->addTravelDateFromNonSeasonTravelPeriod($travelDateKey, $travelPeriod, $flightPeriod,
|
||||
$currencyFactor);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* "Default departures" are taken if a travel period date has no departure itself. For mediated travel programs
|
||||
* default departures are defined at travel program level. For self-organized travel programs they are defined
|
||||
* at travel-arrival-point (airport) level.
|
||||
*
|
||||
* @param TravelProgram $program
|
||||
* @param bool $acp
|
||||
*
|
||||
* @return TravelDeparturePoint[]|array|\Doctrine\Common\Collections\Collection|mixed
|
||||
*/
|
||||
public function getDefaultDeparturesByProgram(TravelProgram $program, $acp = false)
|
||||
{
|
||||
if ($program->getIsMediated())
|
||||
{
|
||||
return $program->getDepartures();
|
||||
}
|
||||
if ($program->getTravelArrivalPoint() == null)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
$defaultDepartures = $program->getTravelArrivalPoint()->getDepartures();
|
||||
if (!$acp)
|
||||
{
|
||||
$defaultDepartures = $this->departureRepository->limitIndividualArrivalPriceInDepartures(
|
||||
$defaultDepartures, $program->getDefaultFlightPrice());
|
||||
}
|
||||
return $defaultDepartures;
|
||||
}
|
||||
}
|
||||
1885
src/AppBundle/Entity/TravelProgram.php
Normal file
1885
src/AppBundle/Entity/TravelProgram.php
Normal file
File diff suppressed because it is too large
Load diff
103
src/AppBundle/Entity/TravelProgramDrafts.php
Normal file
103
src/AppBundle/Entity/TravelProgramDrafts.php
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
<?php
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* TravelProgramDrafts
|
||||
*
|
||||
* @ORM\Table(name="travel_program_drafts", indexes={@ORM\Index(name="travel_program_drafts_ibfk_1", columns={"travel_program_id"})})
|
||||
* @ORM\Entity
|
||||
*/
|
||||
|
||||
class TravelProgramDrafts
|
||||
{
|
||||
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="IDENTITY")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="weekdays", type="string", length=255, nullable=true)
|
||||
*/
|
||||
private $weekdays;
|
||||
|
||||
/**
|
||||
* @var \AppBundle\Entity\TravelProgram
|
||||
*
|
||||
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\TravelProgram", inversedBy="drafts")
|
||||
* @ORM\JoinColumns({
|
||||
* @ORM\JoinColumn(name="travel_program_id", referencedColumnName="id")
|
||||
* })
|
||||
*/
|
||||
private $program;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set program
|
||||
*
|
||||
* @param \AppBundle\Entity\TravelProgram $program
|
||||
*
|
||||
* @return TravelProgramDrafts
|
||||
*/
|
||||
public function setProgram(\AppBundle\Entity\TravelProgram $program = null)
|
||||
{
|
||||
$this->program = $program;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get program
|
||||
*
|
||||
* @return \AppBundle\Entity\TravelProgram
|
||||
*/
|
||||
public function getProgram()
|
||||
{
|
||||
return $this->program;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set weekdays
|
||||
*
|
||||
* @param string TravelProgramDrafts
|
||||
*
|
||||
* @return TravelProgramDrafts
|
||||
*/
|
||||
public function setWeekdays($weekdays)
|
||||
{
|
||||
$this->weekdays = $weekdays;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get weekdays
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getWeekdays()
|
||||
{
|
||||
return $this->weekdays;
|
||||
}
|
||||
}
|
||||
|
||||
235
src/AppBundle/Entity/TravelProgramImage.php
Normal file
235
src/AppBundle/Entity/TravelProgramImage.php
Normal file
|
|
@ -0,0 +1,235 @@
|
|||
<?php
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* TravelProgramImage
|
||||
*
|
||||
* @ORM\Table(name="travel_program_image", indexes={@ORM\Index(name="FK_travel_program_image_travel_program", columns={"program_id"})})
|
||||
* @ORM\Entity
|
||||
*/
|
||||
class TravelProgramImage
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="file_name", type="string", length=255, nullable=true)
|
||||
*/
|
||||
private $fileName;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="extension", type="string", length=255, nullable=true)
|
||||
*/
|
||||
private $extension;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="description", type="string", length=255, nullable=true)
|
||||
*/
|
||||
private $description;
|
||||
|
||||
/**
|
||||
* @var boolean
|
||||
*
|
||||
* @ORM\Column(name="type", type="boolean", nullable=true)
|
||||
*/
|
||||
private $type;
|
||||
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="position", type="string", length=10, nullable=true)
|
||||
*/
|
||||
private $position;
|
||||
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="IDENTITY")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @var \AppBundle\Entity\TravelProgram
|
||||
*
|
||||
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\TravelProgram", inversedBy="images")
|
||||
* @ORM\JoinColumns({
|
||||
* @ORM\JoinColumn(name="program_id", referencedColumnName="id")
|
||||
* })
|
||||
*/
|
||||
private $program;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Set fileName
|
||||
*
|
||||
* @param string $fileName
|
||||
*
|
||||
* @return TravelProgramImage
|
||||
*/
|
||||
public function setFileName($fileName)
|
||||
{
|
||||
$this->fileName = $fileName;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get fileName
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFileName()
|
||||
{
|
||||
return $this->fileName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set extension
|
||||
*
|
||||
* @param string $extension
|
||||
*
|
||||
* @return TravelProgramImage
|
||||
*/
|
||||
public function setExtension($extension)
|
||||
{
|
||||
$this->extension = $extension;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get extension
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getExtension()
|
||||
{
|
||||
return $this->extension;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set description
|
||||
*
|
||||
* @param string $description
|
||||
*
|
||||
* @return TravelProgramImage
|
||||
*/
|
||||
public function setDescription($description)
|
||||
{
|
||||
$this->description = $description;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get description
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDescription()
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set type
|
||||
*
|
||||
* @param boolean $type
|
||||
*
|
||||
* @return TravelProgramImage
|
||||
*/
|
||||
public function setType($type)
|
||||
{
|
||||
$this->type = $type;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get type
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set type
|
||||
*
|
||||
* @param string $position
|
||||
*
|
||||
* @return TravelProgramImage
|
||||
*/
|
||||
public function setPosition($position)
|
||||
{
|
||||
$this->position = $position;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get position
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPosition()
|
||||
{
|
||||
if(!$this->position){
|
||||
return 'bottom';
|
||||
}
|
||||
return $this->position;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set program
|
||||
*
|
||||
* @param \AppBundle\Entity\TravelProgram $program
|
||||
*
|
||||
* @return TravelProgramImage
|
||||
*/
|
||||
public function setProgram(\AppBundle\Entity\TravelProgram $program = null)
|
||||
{
|
||||
$this->program = $program;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get program
|
||||
*
|
||||
* @return \AppBundle\Entity\TravelProgram
|
||||
*/
|
||||
public function getProgram()
|
||||
{
|
||||
return $this->program;
|
||||
}
|
||||
|
||||
public function getFileNameWithExtension()
|
||||
{
|
||||
return $this->getFileName() . $this->getExtension();
|
||||
}
|
||||
}
|
||||
37
src/AppBundle/Entity/TravelProgramRepository.php
Normal file
37
src/AppBundle/Entity/TravelProgramRepository.php
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Query\Expr;
|
||||
|
||||
/**
|
||||
* TravelProgramRepository
|
||||
*
|
||||
* This class was generated by the Doctrine ORM. Add your own custom
|
||||
* repository methods below.
|
||||
*/
|
||||
class TravelProgramRepository extends \Doctrine\ORM\EntityRepository
|
||||
{
|
||||
/**
|
||||
* @return TravelProgram[]
|
||||
*/
|
||||
public function getProgramsToExport()
|
||||
{
|
||||
return $this->createQueryBuilder('tp')
|
||||
->innerJoin('tp.page', 'page')
|
||||
->addSelect('page')
|
||||
->leftJoin('tp.countries', 'country')
|
||||
->addSelect('country')
|
||||
->leftJoin('country.destinations', 'destination')
|
||||
->addSelect('destination')
|
||||
->leftJoin('tp.options', 'option')
|
||||
->addSelect('option')
|
||||
->leftJoin('tp.images', 'image', Expr\Join::WITH, 'image.type = 1')
|
||||
->addSelect('image')
|
||||
->where('tp.status = 1')
|
||||
->andWhere('tp.programType = '. TravelProgram::ORGANIZED_PROGRAM_TYPE)
|
||||
->getQuery()
|
||||
->execute()
|
||||
;
|
||||
}
|
||||
}
|
||||
97
src/AppBundle/Entity/TravelSetting.php
Normal file
97
src/AppBundle/Entity/TravelSetting.php
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
<?php
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* TravelSetting
|
||||
*
|
||||
* @ORM\Table(name="travel_setting")
|
||||
* @ORM\Entity(repositoryClass="AppBundle\Entity\TravelSettingRepository")
|
||||
*/
|
||||
class TravelSetting
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="key", type="string", length=255, nullable=false)
|
||||
*/
|
||||
private $key;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="value", type="string", length=255, nullable=false)
|
||||
*/
|
||||
private $value;
|
||||
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="IDENTITY")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Set key
|
||||
*
|
||||
* @param string $key
|
||||
*
|
||||
* @return TravelSetting
|
||||
*/
|
||||
public function setKey($key)
|
||||
{
|
||||
$this->key = $key;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get key
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getKey()
|
||||
{
|
||||
return $this->key;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set value
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return TravelSetting
|
||||
*/
|
||||
public function setValue($value)
|
||||
{
|
||||
$this->value = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get value
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getValue()
|
||||
{
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
}
|
||||
13
src/AppBundle/Entity/TravelSettingRepository.php
Normal file
13
src/AppBundle/Entity/TravelSettingRepository.php
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
/**
|
||||
* TravelSettingRepository
|
||||
*
|
||||
* This class was generated by the Doctrine ORM. Add your own custom
|
||||
* repository methods below.
|
||||
*/
|
||||
class TravelSettingRepository extends \Doctrine\ORM\EntityRepository
|
||||
{
|
||||
}
|
||||
212
src/AppBundle/Entity/Traveler.php
Normal file
212
src/AppBundle/Entity/Traveler.php
Normal file
|
|
@ -0,0 +1,212 @@
|
|||
<?php
|
||||
/**
|
||||
* @author Ulrich Hecht <ulrich.hecht@hecht-software.de>
|
||||
* @date 02/10/2017
|
||||
*/
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
class Traveler
|
||||
{
|
||||
// Used in SternToursCrmBookingExports, expected to be equivalent to salutation (as defined in BookingRequest)
|
||||
const MALE = 1;
|
||||
const FEMALE = 2;
|
||||
|
||||
|
||||
private $NATIONALITIES = [];
|
||||
|
||||
/**
|
||||
* @Assert\NotNull
|
||||
* @Assert\Choice(choices={1,2})
|
||||
*/
|
||||
private $sex;
|
||||
|
||||
/**
|
||||
* @Assert\NotBlank()
|
||||
*/
|
||||
private $firstName;
|
||||
|
||||
/**
|
||||
* @Assert\NotBlank()
|
||||
*/
|
||||
private $lastName;
|
||||
|
||||
/**
|
||||
* @Assert\NotBlank()
|
||||
*/
|
||||
private $birthDate;
|
||||
|
||||
/**
|
||||
* @Assert\NotBlank()
|
||||
*/
|
||||
private $nationality;
|
||||
|
||||
/**
|
||||
* @Assert\IsTrue()
|
||||
*/
|
||||
private $acceptEntryRequirements = false;
|
||||
|
||||
/**
|
||||
* @Assert\IsTrue()
|
||||
*/
|
||||
private $child = false;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
function __construct()
|
||||
{
|
||||
$this->nationalities = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getSex()
|
||||
{
|
||||
return $this->sex;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $sex
|
||||
*/
|
||||
public function setSex($sex)
|
||||
{
|
||||
$this->sex = $sex;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getFirstName()
|
||||
{
|
||||
return $this->firstName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $firstName
|
||||
*/
|
||||
public function setFirstName($firstName)
|
||||
{
|
||||
$this->firstName = $firstName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getLastName()
|
||||
{
|
||||
return $this->lastName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $lastName
|
||||
*/
|
||||
public function setLastName($lastName)
|
||||
{
|
||||
$this->lastName = $lastName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getBirthDate()
|
||||
{
|
||||
if($this->birthDate != null && $this->birthDate != ""){
|
||||
if(!is_object($this->birthDate) && !strtotime($this->birthDate)){
|
||||
return '01.01.1900';
|
||||
}
|
||||
}
|
||||
return $this->birthDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $birthDate
|
||||
*/
|
||||
public function setBirthDate($birthDate)
|
||||
{
|
||||
|
||||
$this->birthDate = $birthDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getNationality()
|
||||
{
|
||||
return $this->nationality;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $nationality
|
||||
*/
|
||||
public function setNationality($nationality)
|
||||
{
|
||||
$this->nationality = $nationality;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getNationalityName($nat)
|
||||
{
|
||||
if(!count($this->NATIONALITIES)){
|
||||
foreach ($nat as $na){
|
||||
$this->NATIONALITIES[$na['id']] = $na['name'];
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($this->NATIONALITIES[$this->nationality])){
|
||||
return $this->NATIONALITIES[$this->nationality];
|
||||
}
|
||||
/*
|
||||
if(isset($this->NATIONALITIES[$this->nationality])){
|
||||
return $this->NATIONALITIES[$this->nationality];
|
||||
}*/
|
||||
return $this->nationality;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function isAcceptEntryRequirements()
|
||||
{
|
||||
return $this->acceptEntryRequirements;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param mixed $acceptEntryRequirements
|
||||
*/
|
||||
|
||||
public function setAcceptEntryRequirements($acceptEntryRequirements)
|
||||
{
|
||||
$this->acceptEntryRequirements = $acceptEntryRequirements;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function isChild()
|
||||
{
|
||||
return $this->child;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param mixed $child
|
||||
*/
|
||||
|
||||
public function setChild($child)
|
||||
{
|
||||
$this->child = $child;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
97
src/AppBundle/Entity/WikiPage.php
Normal file
97
src/AppBundle/Entity/WikiPage.php
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
<?php
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* WikiPage
|
||||
*
|
||||
* @ORM\Table(name="wiki_page")
|
||||
* @ORM\Entity
|
||||
*/
|
||||
class WikiPage
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="title", type="string", length=255, nullable=true)
|
||||
*/
|
||||
private $title;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="content", type="text", nullable=true)
|
||||
*/
|
||||
private $content;
|
||||
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="IDENTITY")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Set title
|
||||
*
|
||||
* @param string $title
|
||||
*
|
||||
* @return WikiPage
|
||||
*/
|
||||
public function setTitle($title)
|
||||
{
|
||||
$this->title = $title;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get title
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle()
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set content
|
||||
*
|
||||
* @param string $content
|
||||
*
|
||||
* @return WikiPage
|
||||
*/
|
||||
public function setContent($content)
|
||||
{
|
||||
$this->content = $content;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get content
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getContent()
|
||||
{
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue