git-svn-id: http://78.47.251.156/svn/dev/sterntours-3@3283 f459cee4-fb09-11de-96c3-f9c5f16c3c76

This commit is contained in:
uli 2016-12-17 10:11:28 +00:00
parent 75a065758f
commit 7422f06e90
261 changed files with 83347 additions and 0 deletions

View file

@ -0,0 +1,117 @@
<?php
/**
* @author Ulrich Hecht <ulrich.hecht@hecht-software.de>
* @date 12/16/2016
*/
namespace AppBundle\Entity;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
class BookingRequest
{
/**
* @var TravelDeparturePoint $departure
*/
private $departure;
private $travelerCount;
/**
* @var TravelInsurance $insurance
*/
private $insurance;
private $comfort;
private $travelOptions;
/**
* @return TravelDeparturePoint
*/
public function getDeparture(): TravelDeparturePoint
{
return $this->departure;
}
/**
* @param TravelDeparturePoint $departure
*/
public function setDeparture(TravelDeparturePoint $departure)
{
$this->departure = $departure;
}
/**
* @return mixed
*/
public function getTravelerCount()
{
return $this->travelerCount;
}
/**
* @param mixed $travelerCount
*/
public function setTravelerCount($travelerCount)
{
$this->travelerCount = $travelerCount;
}
/**
* @return TravelInsurance
*/
public function getInsurance(): TravelInsurance
{
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 mixed
*/
public function getTravelOptions()
{
return $this->travelOptions;
}
/**
* @param mixed $travelOptions
*/
public function setTravelOptions($travelOptions)
{
$this->travelOptions = $travelOptions;
}
/**
* @Assert\Callback
*/
public function validate(ExecutionContextInterface $context, $payload)
{
//$context->
}
}

View 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)
{
$this->title = $title;
$this->url = $url;
}
/**
* @return String
*/
public function getTitle()
{
return $this->title;
}
/**
* @return String
*/
public function getUrl()
{
return $this->url;
}
}

View 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;
}
}

View 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;
}
}

View file

@ -0,0 +1,13 @@
<?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
{
}

View 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;
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,40 @@
<?php
namespace AppBundle\Entity;
use Gedmo\Tree\Entity\Repository\NestedTreeRepository;
/**
* 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')
->getQuery()
->execute();
/** @var Page $childPage */
foreach ($pages as &$childPage)
{
if ($childPage->getTravelProgram())
{
$this->getEntityManager()->getRepository('AppBundle:TravelPeriod')->getTrueTravelPeriods(
$childPage->getTravelProgram());
}
}
return $pages;
}
}

View 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;
}
}

View 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;
}
}

File diff suppressed because it is too large Load diff

View 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;
}
}

View 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;
}
}

View file

@ -0,0 +1,131 @@
<?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
*/
class TravelCountry
{
/**
* @var string
*
* @ORM\Column(name="name", type="string", length=255, nullable=true)
*/
private $name;
/**
* @var string
*
* @ORM\Column(name="html_information", type="text", length=65535, nullable=false)
*/
private $htmlInformation;
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/**
* @var \AppBundle\Entity\Page
*
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\Page")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="feedback_page_id", referencedColumnName="id")
* })
*/
private $feedbackPage;
/**
* 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 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;
}
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* 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;
}
}

View file

@ -0,0 +1,266 @@
<?php
/**
* @author Ulrich Hecht <ulrich.hecht@hecht-software.de>
* @date 11/03/2016
*/
namespace AppBundle\Entity;
use AppBundle\Util\DepartureUtil;
/**
* 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->flightPeriod = $flightPeriod;
}
else
{
$this->start = $travelPeriod->getStartDate();
}
$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 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 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($defaultDepartures, $departures, true);
}
return $this->departures;
}
/**
* @return TravelPeriodPrice[]|\Doctrine\Common\Collections\Collection
*/
public function getPrices()
{
if (!$this->calculatedEffectivePrices)
{
$this->calculatedEffectivePrices = true;
if ($this->travelProgram->getIsMediated())
{
$profitMargin = 1;
$flightPrice = 0;
}
else
{
$profitMargin = $this->travelProgram->getProfitMargin() / 100 + 1;
$flightPrice = null;
if ($this->flightPeriod !== null)
{
$flightPrice = $this->flightPeriod->getPrice();
}
if ($flightPrice === null)
{
$flightPrice = $this->travelProgram->getDefaultFlightPrice();
}
}
$currencyFactor = $this->travelProgram->getNettoPricesInEuro() ? 1 : $this->currencyFactor;
foreach ($this->travelPeriod->getPrices() as $price)
{
$price->setEffectivePrice(round(($flightPrice + $price->getPrice() * $currencyFactor) * $profitMargin));
$price->setEffectiveDiscountPrice(
round(($flightPrice + $price->getDiscountPrice() * $currencyFactor) * $profitMargin));
//$price->setEffectiveDiscountPrice($pr)
}
}
return $this->travelPeriod->getPrices();
}
public function getLowestPrice()
{
$lowest = -1;
foreach ($this->getPrices() as $price)
{
if ($price->getPriceType() == 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 TravelPeriod
* @internal
*/
public function __getTravelPeriod()
{
return $this->travelPeriod;
}
}

View file

@ -0,0 +1,352 @@
<?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="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 string
*/
public function getExtraCharge()
{
return $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 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();
}
}

View 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;
}
}

View file

@ -0,0 +1,8 @@
<?php
namespace AppBundle\Entity;
class TravelDeparturePointRepository extends \Doctrine\ORM\EntityRepository
{
}

View file

@ -0,0 +1,100 @@
<?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")
* @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;
}
}

View 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;
}
}

View file

@ -0,0 +1,178 @@
<?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 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 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();
}
}

View file

@ -0,0 +1,193 @@
<?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
*/
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="percent", type="float", precision=10, scale=2, nullable=true)
*/
private $percent;
/**
* @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 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 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;
}
}

View 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();
}
}

View file

@ -0,0 +1,159 @@
<?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 \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 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 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;
}
/**
* 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 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;
}
}

View 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 boolean $status
*
* @return TravelPeriod
*/
public function setStatus($status)
{
$this->status = $status;
return $this;
}
/**
* Get status
*
* @return boolean
*/
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();
}
}

View 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;
}
}

View file

@ -0,0 +1,292 @@
<?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 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 $effectiveDiscountPrice = null;
/**
* 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 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;
}
/**
* 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;
}
public function getDiscountPrice()
{
if ($this->getPeriod() == null)
{
return null;
}
// #TODO FIX! Discount calculation differs for period and program
$price = $this->price; // #TODO Is the discount calculated for the effective price or for the original price?
$newPrice = $price;
foreach ($this->getPeriod()->getDiscounts() as $discount)
{
$newPrice -= $discount->getPercent()
? round($newPrice * $discount->getValue() / 100, 2) // FIXME
: $discount->getValue();
}
$program = $this->getPeriod()->getProgram();
if ($program != null && $program->getDiscount() != null)
{
$newPrice -= $program->getDiscountIsPercentValue()
? round($price * $program->getDiscount() / 100, 2) // FIXME
: $program->getDiscount();
}
return $price == $newPrice ? null : $newPrice;
}
/**
* @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 getEffectiveDiscountPrice()
{
if ($this->effectiveDiscountPrice === null)
{
throw new \Exception('Effective discount price must be set from outside before reading it.');
}
return $this->effectiveDiscountPrice;
}
/**
* @param float $effectiveDiscountPrice
*/
public function setEffectiveDiscountPrice($effectiveDiscountPrice)
{
$this->effectiveDiscountPrice = $effectiveDiscountPrice;
}
/**
* 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;
}
}

View 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;
}
}

View 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();
}
}

View file

@ -0,0 +1,490 @@
<?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');
$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->where("((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(), null, $priceTypeKey .'.priceType');
$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) .')');
if ($combi)
{
$qb->having('COUNT(DISTINCT tpc.country) = '. count($destinationIds));
}
}
$qb->groupBy('p.id, p_dep.id, d.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 = [];
if (!empty($isUsedArrivalPointById))
{
$qb = $this->getEntityManager()->createQueryBuilder();
$unindexedFlightPeriods = $qb
->from('AppBundle:FlightPeriod', 'fp')
->addSelect('fp')
->leftJoin('fp.departures', 'fp_dep')
->addSelect('fp_dep')
->where('fp.startDate >= :startDate')
->andWhere('fp.endDate <= :endDate')
->andWhere($qb->expr()->in('IDENTITY(fp.travelArrivalPoint)', $usedArrivalPointIds))
->setParameter('startDate', $startDate)
->setParameter('endDate', $endDate)
->getQuery()->getResult();
// Index by CONCAT(start date, end date, arrival point id):
/** @var FlightPeriod $flightPeriod */
foreach ($unindexedFlightPeriods as $flightPeriod)
{
$flightPeriods[$flightPeriod->getStartDate()->format('Y-m-d') .
$flightPeriod->getEndDate()->format('Y-m-d') .
$flightPeriod->getTravelArrivalPoint()->getId()] = $flightPeriod;
}
}
// 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 $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);
}
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;
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');
}
else
{
$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');
$qb->andWhere("((p.isSeason = 0 AND d.startDate >= CURRENT_TIMESTAMP()) OR".
" (p.isSeason = 1 AND d.endDate >= CURRENT_TIMESTAMP()))");
}
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')
;
// #TODO Try to optimize this later
$entities = $qb->getQuery()->execute();
$flightPeriodByKey = [];
if (!$program->getIsMediated())
{
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();
// #TODO Consider adding travelPeriods to travelProgram in the search algorithm
//foreach ($travelProgram->getPeriods() as $travelPeriod)
foreach ($travelPeriods as $travelPeriod)
{
if ($travelPeriod->getIsSeason())
{
$i = 1;
foreach ($travelPeriod->getDates() as $travelPeriodDate)
{
$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!)
$seasonEndDate->modify('-'.$travelProgram->getProgramDuration().' 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() . $i,
$date,
$travelDateEnd,
$flightPeriod,
$currencyFactor
);
}
}
}
// Also increment $i if the date is theoretically possible but excluded from the search request
if ($isPossibleDate)
{
++$i;
}
}
}
}
elseif ($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
{
$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;
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,103 @@
<?php
namespace AppBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* TravelProgramDestination
*
* @ORM\Table(name="travel_program_destination", indexes={@ORM\Index(name="FK_travel_program_destination_travel_program", columns={"program_id"}), @ORM\Index(name="FK_travel_program_destination_travel_destination", columns={"destination_id"})})
* @ORM\Entity
*/
class TravelProgramDestination
{
/**
* @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;
/**
* @var \AppBundle\Entity\TravelDestination
*
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\TravelDestination")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="destination_id", referencedColumnName="id")
* })
*/
private $destination;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set program
*
* @param \AppBundle\Entity\TravelProgram $program
*
* @return TravelProgramDestination
*/
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 destination
*
* @param \AppBundle\Entity\TravelDestination $destination
*
* @return TravelProgramDestination
*/
public function setDestination(\AppBundle\Entity\TravelDestination $destination = null)
{
$this->destination = $destination;
return $this;
}
/**
* Get destination
*
* @return \AppBundle\Entity\TravelDestination
*/
public function getDestination()
{
return $this->destination;
}
}

View file

@ -0,0 +1,198 @@
<?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 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;
}
/**
* 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();
}
}

View file

@ -0,0 +1,134 @@
<?php
namespace AppBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* TravelProgramRelated
*
* @ORM\Table(name="travel_program_related", indexes={@ORM\Index(name="FK_travel_program_related_travel_program", columns={"program_1"}), @ORM\Index(name="FK_travel_program_related_travel_program_2", columns={"program_2"})})
* @ORM\Entity
*/
class TravelProgramRelated
{
/**
* @var string
*
* @ORM\Column(name="description", type="string", length=255, nullable=true)
*/
private $description;
/**
* @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_1", referencedColumnName="id")
* })
*/
private $program1;
/**
* @var \AppBundle\Entity\TravelProgram
*
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\TravelProgram")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="program_2", referencedColumnName="id")
* })
*/
private $program2;
/**
* Set description
*
* @param string $description
*
* @return TravelProgramRelated
*/
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;
}
/**
* Set program1
*
* @param \AppBundle\Entity\TravelProgram $program1
*
* @return TravelProgramRelated
*/
public function setProgram1(\AppBundle\Entity\TravelProgram $program1 = null)
{
$this->program1 = $program1;
return $this;
}
/**
* Get program1
*
* @return \AppBundle\Entity\TravelProgram
*/
public function getProgram1()
{
return $this->program1;
}
/**
* Set program2
*
* @param \AppBundle\Entity\TravelProgram $program2
*
* @return TravelProgramRelated
*/
public function setProgram2(\AppBundle\Entity\TravelProgram $program2 = null)
{
$this->program2 = $program2;
return $this;
}
/**
* Get program2
*
* @return \AppBundle\Entity\TravelProgram
*/
public function getProgram2()
{
return $this->program2;
}
}

View file

@ -0,0 +1,13 @@
<?php
namespace AppBundle\Entity;
/**
* TravelProgramRepository
*
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.
*/
class TravelProgramRepository extends \Doctrine\ORM\EntityRepository
{
}

View 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;
}
}

View 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
{
}

View 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;
}
}