src/Entity/Booking.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  5. use Symfony\Component\Validator\Constraints as Assert;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Doctrine\Common\Collections\Collection;
  8. /**
  9.  * @ORM\Entity(repositoryClass="App\Repository\BookingRepository")
  10.  * @ORM\Table(name="booking")
  11.  *
  12.  * @UniqueEntity(fields={"reference"}, message="This reference is already used.")
  13.  */
  14. class Booking
  15. {
  16.     /**
  17.      * @ORM\Id
  18.      * @ORM\GeneratedValue
  19.      * @ORM\Column(type="integer")
  20.      */
  21.     private ?int $id null;
  22.     /**
  23.      * @ORM\Column(type="string", length=255, unique=true, nullable=true)
  24.      * @Assert\NotBlank()
  25.      */
  26.     private ?string $reference null;
  27.     /**
  28.      * @ORM\Column(type="datetime", nullable=true)
  29.      */
  30.     private \DateTime $createdAt;
  31.     /**
  32.      * @ORM\Column(type="datetime", nullable=true)
  33.      */
  34.     private \DateTime $datestart;
  35.     /**
  36.      * @ORM\Column(type="integer", nullable=true)
  37.      */
  38.     private ?string $duration null;
  39.     /**
  40.      * @ORM\Column(type="integer", nullable=true)
  41.      */
  42.     private int $total;
  43.     /**
  44.      * @ORM\Column(type="string", nullable=true)
  45.      */
  46.     private string $currency;
  47.     /**
  48.      * @ORM\Column(type="string", length=255, nullable=true)
  49.      */
  50.     private ?string $paymentId null;
  51.     /**
  52.      * @ORM\Column(type="string", length=255, nullable=true)
  53.      */
  54.     private ?string $paymentType null;
  55.     /**
  56.      * @ORM\Column(type="integer", nullable=true)
  57.      */
  58.     private ?string $pax null;
  59.     /**
  60.      * @ORM\Column(type="string", nullable=true)
  61.      */
  62.     private ?string $hebergementprice null;
  63.     /**
  64.      * @ORM\Column(type="string", nullable=true)
  65.      */
  66.     private ?string $hebergementname null;
  67.     /**
  68.      * @ORM\OneToMany(targetEntity="App\Entity\Payment", mappedBy="booking", cascade={"persist","remove"})
  69.      */
  70.     private Collection $payments;
  71.     
  72.         
  73.     /**
  74.      * @ORM\ManyToOne(targetEntity="App\Entity\User", inversedBy="bookings")
  75.      * @ORM\JoinColumn(name="customer_id", referencedColumnName="id")
  76.      */
  77.     private $customer;
  78.         
  79.     /**
  80.      * @ORM\ManyToOne(targetEntity="App\Entity\Experience", inversedBy="bookings")
  81.      * @ORM\JoinColumn(name="experience_id", referencedColumnName="id")
  82.      */
  83.     private $experience;
  84.     /**
  85.      * @ORM\Column(type="string", length=255, nullable=true)
  86.      */
  87.     private ?string $status null;
  88. //    0. PENDING 1.CONFIRMED 3.CANCELED
  89.     public function __construct()
  90.     {
  91.         $this->createdAt = new \DateTime('now');
  92.         $this->payments  = new ArrayCollection();
  93.     }
  94.     public function getId(): ?int
  95.     {
  96.         return $this->id;
  97.     }
  98.     public function getReference(): ?string
  99.     {
  100.         return $this->reference;
  101.     }
  102.     public function setReference(string $reference): self
  103.     {
  104.         $this->reference $reference;
  105.         return $this;
  106.     }
  107.     public function getCreatedAt(): \DateTime
  108.     {
  109.         return $this->createdAt;
  110.     }
  111.     public function setCreatedAt(\DateTime $createdAt): self
  112.     {
  113.         $this->createdAt $createdAt;
  114.         return $this;
  115.     }
  116.     public function getTotal(): int {
  117.         return $this->total;
  118.     }
  119.     public function setTotal(int $total): void {
  120.         $this->total $total;
  121.     }
  122.     
  123.     public function getCurrency(): string
  124.     {
  125.         return $this->currency;
  126.     }
  127.     public function setCurrency(string $currency): self
  128.     {
  129.         $this->currency $currency;
  130.         return $this;
  131.     }
  132.     public function getPaymentId(): ?string
  133.     {
  134.         return $this->paymentId;
  135.     }
  136.     public function setPaymentId(?string $paymentId): self
  137.     {
  138.         $this->paymentId $paymentId;
  139.         return $this;
  140.     }
  141.     public function getDatestart(): \DateTime {
  142.         return $this->datestart;
  143.     }
  144.     public function getDuration(): ?string {
  145.         return $this->duration;
  146.     }
  147.     public function getPax(): ?string {
  148.         return $this->pax;
  149.     }
  150.     public function setDatestart(\DateTime $datestart): void {
  151.         $this->datestart $datestart;
  152.     }
  153.     public function setDuration(?string $duration): void {
  154.         $this->duration $duration;
  155.     }
  156.     public function setPax(?string $pax): void {
  157.         $this->pax $pax;
  158.     }
  159.     public function getHebergementprice(): ?string {
  160.         return $this->hebergementprice;
  161.     }
  162.     public function getHebergementname(): ?string {
  163.         return $this->hebergementname;
  164.     }
  165.     public function setHebergementprice(?string $hebergementprice): void {
  166.         $this->hebergementprice $hebergementprice;
  167.     }
  168.     public function setHebergementname(?string $hebergementname): void {
  169.         $this->hebergementname $hebergementname;
  170.     }
  171.     public function getPaymentType(): ?string {
  172.         return $this->paymentType;
  173.     }
  174.     public function setPaymentType(?string $paymentType): void {
  175.         $this->paymentType $paymentType;
  176.     }
  177.     public function getPayments(): Collection
  178.     {
  179.         return $this->payments;
  180.     }
  181.     public function addPayment(Payment $payment): self
  182.     {
  183.         if (!$this->payments->contains($payment)) {
  184.             $this->payments->add($payment);
  185.             $payment->setBooking($this);
  186.         }
  187.         return $this;
  188.     }
  189.     public function removePayment(Payment $payment): self
  190.     {
  191.         if ($this->payments->removeElement($payment)) {
  192.             // set the owning side to null (unless already changed)
  193.             if ($payment->getBooking() === $this) {
  194.                 $payment->setBooking(null);
  195.             }
  196.         }
  197.         return $this;
  198.     }
  199.     
  200.     public function getCustomer() {
  201.         return $this->customer;
  202.     }
  203.     public function setCustomer($customer): void {
  204.         $this->customer $customer;
  205.     }
  206.     public function getStatus(): ?string {
  207.         return $this->status;
  208.     }
  209.     public function setStatus(?string $status): void {
  210.         $this->status $status;
  211.     }
  212.     public function getExperience() {
  213.         return $this->experience;
  214.     }
  215.     public function setExperience($experience): void {
  216.         $this->experience $experience;
  217.     }
  218. }