#1342 #1343 #1345 #1346 #1349 git-svn-id: http://78.47.251.156/svn/dev/sterntours-3@3340 f459cee4-fb09-11de-96c3-f9c5f16c3c76
87 lines
No EOL
1.5 KiB
PHP
87 lines
No EOL
1.5 KiB
PHP
<?php
|
|
|
|
namespace AppBundle\Entity;
|
|
|
|
use Symfony\Component\Validator\Constraints as Assert;
|
|
|
|
class Room
|
|
{
|
|
// von BookingRequest abgeguckt, brauch ich das überhaupt, wenn ich bei $type ein Assert habe?
|
|
const SINGLE = 1;
|
|
const DOUBLE = 2;
|
|
const TRIPLE = 3;
|
|
|
|
/**
|
|
* @Assert\NotNull
|
|
* @Assert\Choice(choices={1,2,3})
|
|
*/
|
|
private $type;
|
|
|
|
/**
|
|
* @Assert\Valid
|
|
*/
|
|
private $travelers = [];
|
|
|
|
private $travelerCount;
|
|
|
|
public function __construct($type)
|
|
{
|
|
$this->type = $type;
|
|
for($i = 0; $i < $this->type; $i++)
|
|
{
|
|
$this->travelers[] = new Traveler();
|
|
}
|
|
|
|
$this->travelerCount = $type;
|
|
}
|
|
|
|
/**
|
|
* @return int
|
|
*/
|
|
public function getType()
|
|
{
|
|
return $this->type;
|
|
}
|
|
|
|
/**
|
|
* @param int $type
|
|
*/
|
|
public function setType($type)
|
|
{
|
|
$this->type = $type;
|
|
}
|
|
|
|
/**
|
|
* @return Traveler[]
|
|
*/
|
|
public function getTravelers()
|
|
{
|
|
return $this->travelers;
|
|
}
|
|
|
|
/**
|
|
* @param Traveler[] $travelers
|
|
*/
|
|
public function setTravelers($travelers)
|
|
{
|
|
$this->travelers = $travelers;
|
|
}
|
|
|
|
/**
|
|
* @return mixed
|
|
*/
|
|
public function getTravelerCount()
|
|
{
|
|
return $this->travelerCount;
|
|
}
|
|
|
|
/**
|
|
* @param mixed $travelerCount
|
|
*/
|
|
public function setTravelerCount($travelerCount)
|
|
{
|
|
$this->travelerCount = $travelerCount;
|
|
}
|
|
|
|
|
|
} |