212 lines
No EOL
3.9 KiB
PHP
212 lines
No EOL
3.9 KiB
PHP
<?php
|
|
/**
|
|
* @author Ulrich Hecht <ulrich.hecht@hecht-software.de>
|
|
* @date 02/10/2017
|
|
*/
|
|
|
|
namespace AppBundle\Entity;
|
|
|
|
use Symfony\Component\Validator\Constraints as Assert;
|
|
|
|
class Traveler
|
|
{
|
|
// Used in SternToursCrmBookingExports, expected to be equivalent to salutation (as defined in BookingRequest)
|
|
const MALE = 1;
|
|
const FEMALE = 2;
|
|
|
|
|
|
private $NATIONALITIES = [];
|
|
|
|
/**
|
|
* @Assert\NotNull
|
|
* @Assert\Choice(choices={1,2})
|
|
*/
|
|
private $sex;
|
|
|
|
/**
|
|
* @Assert\NotBlank()
|
|
*/
|
|
private $firstName;
|
|
|
|
/**
|
|
* @Assert\NotBlank()
|
|
*/
|
|
private $lastName;
|
|
|
|
/**
|
|
* @Assert\NotBlank()
|
|
*/
|
|
private $birthDate;
|
|
|
|
/**
|
|
* @Assert\NotBlank()
|
|
*/
|
|
private $nationality;
|
|
|
|
/**
|
|
* @Assert\IsTrue()
|
|
*/
|
|
private $acceptEntryRequirements = false;
|
|
|
|
/**
|
|
* @Assert\IsTrue()
|
|
*/
|
|
private $child = false;
|
|
|
|
/**
|
|
* Constructor
|
|
*/
|
|
function __construct()
|
|
{
|
|
$this->nationalities = new \Doctrine\Common\Collections\ArrayCollection();
|
|
|
|
}
|
|
|
|
/**
|
|
* @return int
|
|
*/
|
|
public function getSex()
|
|
{
|
|
return $this->sex;
|
|
}
|
|
|
|
/**
|
|
* @param int $sex
|
|
*/
|
|
public function setSex($sex)
|
|
{
|
|
$this->sex = $sex;
|
|
}
|
|
|
|
/**
|
|
* @return string
|
|
*/
|
|
public function getFirstName()
|
|
{
|
|
return $this->firstName;
|
|
}
|
|
|
|
/**
|
|
* @param string $firstName
|
|
*/
|
|
public function setFirstName($firstName)
|
|
{
|
|
$this->firstName = $firstName;
|
|
}
|
|
|
|
/**
|
|
* @return string
|
|
*/
|
|
public function getLastName()
|
|
{
|
|
return $this->lastName;
|
|
}
|
|
|
|
/**
|
|
* @param string $lastName
|
|
*/
|
|
public function setLastName($lastName)
|
|
{
|
|
$this->lastName = $lastName;
|
|
}
|
|
|
|
/**
|
|
* @return string
|
|
*/
|
|
public function getBirthDate()
|
|
{
|
|
if($this->birthDate != null && $this->birthDate != ""){
|
|
if(!is_object($this->birthDate) && !strtotime($this->birthDate)){
|
|
return '01.01.1900';
|
|
}
|
|
}
|
|
return $this->birthDate;
|
|
}
|
|
|
|
/**
|
|
* @param string $birthDate
|
|
*/
|
|
public function setBirthDate($birthDate)
|
|
{
|
|
|
|
$this->birthDate = $birthDate;
|
|
}
|
|
|
|
/**
|
|
* @return int
|
|
*/
|
|
public function getNationality()
|
|
{
|
|
return $this->nationality;
|
|
}
|
|
|
|
/**
|
|
* @param int $nationality
|
|
*/
|
|
public function setNationality($nationality)
|
|
{
|
|
$this->nationality = $nationality;
|
|
}
|
|
|
|
|
|
/**
|
|
* @return int
|
|
*/
|
|
public function getNationalityName($nat)
|
|
{
|
|
if(!count($this->NATIONALITIES)){
|
|
foreach ($nat as $na){
|
|
$this->NATIONALITIES[$na['id']] = $na['name'];
|
|
}
|
|
}
|
|
|
|
if(isset($this->NATIONALITIES[$this->nationality])){
|
|
return $this->NATIONALITIES[$this->nationality];
|
|
}
|
|
/*
|
|
if(isset($this->NATIONALITIES[$this->nationality])){
|
|
return $this->NATIONALITIES[$this->nationality];
|
|
}*/
|
|
return $this->nationality;
|
|
}
|
|
|
|
|
|
/**
|
|
* @return mixed
|
|
*/
|
|
public function isAcceptEntryRequirements()
|
|
{
|
|
return $this->acceptEntryRequirements;
|
|
}
|
|
|
|
|
|
/**
|
|
* @param mixed $acceptEntryRequirements
|
|
*/
|
|
|
|
public function setAcceptEntryRequirements($acceptEntryRequirements)
|
|
{
|
|
$this->acceptEntryRequirements = $acceptEntryRequirements;
|
|
}
|
|
|
|
|
|
/**
|
|
* @return mixed
|
|
*/
|
|
public function isChild()
|
|
{
|
|
return $this->child;
|
|
}
|
|
|
|
|
|
/**
|
|
* @param mixed $child
|
|
*/
|
|
|
|
public function setChild($child)
|
|
{
|
|
$this->child = $child;
|
|
}
|
|
|
|
|
|
} |