Skip to content

Instantly share code, notes, and snippets.

/Seance.php Secret

Created February 4, 2015 19:58
Show Gist options
  • Save anonymous/8e88d6acac0816b05468 to your computer and use it in GitHub Desktop.
Save anonymous/8e88d6acac0816b05468 to your computer and use it in GitHub Desktop.
<?php
/**
* Created by PhpStorm.
* User: bb
* Date: 26.01.15
* Time: 21:45
*/
namespace WowStudio\Bundle\CinemaSystemBundle\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
/**
* Seance Entity
* @package WowStudio\Bundle\CinemaSystemBundle\Entity
*
* @ORM\Entity(repositoryClass="WowStudio\Bundle\CinemaSystemBundle\Repository\SeanceRepository")
* @ORM\Table(name="Seance")
*/
class Seance
{
/**
* Seance ID
* @var int
*
* @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*
* @Assert\GreaterThanOrEqual(value=0)
*/
private $idSeance;
/**
* Movie
* @var Movie
*
* @ORM\ManyToOne(targetEntity="Movie", inversedBy="seances")
* @ORM\JoinColumn(name="idMovie", referencedColumnName="idMovie")
*/
private $movie;
/**
* Cinema
* @var Cinema
*
* @ORM\ManyToOne(targetEntity="Cinema", inversedBy="seances")
* @ORM\JoinColumn(name="idCinema", referencedColumnName="idCinema")
*/
private $cinema;
/**
* Date and time of show
* @var \DateTime
*
* @ORM\Column(type="datetime")
*
* @Assert\DateTime()
*/
private $dateTime;
/**
* @var int
*
*
*/
public $reservedTickets;
/**
* @var ArrayCollection
*/
private $reservations;
function __construct()
{
$this->setDateTime(new \DateTime());
$this->reservations = new ArrayCollection();
}
/**
* @return int
*/
public function getIdSeance()
{
return $this->idSeance;
}
/**
* @param int $idSeance
*/
public function setIdSeance($idSeance)
{
$this->idSeance = (int)$idSeance;
}
/**
* @return Movie
*/
public function getMovie()
{
return $this->movie;
}
/**
* @param Movie $movie
*/
public function setMovie(Movie $movie)
{
$this->movie = $movie;
}
/**
* @return Cinema
*/
public function getCinema()
{
return $this->cinema;
}
/**
* @param Cinema $cinema
*/
public function setCinema(Cinema $cinema)
{
$this->cinema = $cinema;
}
/**
* @return \DateTime
*/
public function getDateTime()
{
return $this->dateTime;
}
/**
* @param \DateTime $dateTime
*/
public function setDateTime($dateTime)
{
if ($dateTime instanceof \DateTime) {
$this->dateTime = $dateTime;
} else {
$this->dateTime = new \DateTime($dateTime);
}
}
/**
* @return ArrayCollection
*/
public function getReservations()
{
return $this->reservations;
}
/**
* @param Reservation $reservation
*/
public function addReservation(Reservation $reservation)
{
$reservation->setSeance($this);
$this->getReservations()->add($reservation);
}
/**
* @param Reservation $reservation
*/
public function removeReservation(Reservation $reservation)
{
$this->getReservations()->removeElement($reservation);
}
/**
* @return int
*/
public function getReservedTickets()
{
return $this->reservedTickets;
}
/**
* @param int $reservedTickets
*/
public function setReservedTickets($reservedTickets)
{
$this->reservedTickets = $reservedTickets;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment