src/MDS/VenuesBundle/Entity/Reservation.php line 29

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\MDS\VenuesBundle\Entity;
  4. use App\Entity\GpReminder;
  5. use App\Entity\Client;
  6. use App\Entity\HtFile;
  7. use App\MDS\AvexpressBundle\Entity\AveFiles;
  8. use App\Entity\DocContract;
  9. use Doctrine\Common\Collections\ArrayCollection;
  10. use Doctrine\Common\Collections\Collection;
  11. use Doctrine\ORM\Mapping as ORM;
  12. use Symfony\Component\Validator\Constraints as Assert;
  13. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  14. use Symfony\Component\Serializer\Annotation\Ignore;
  15. //use Doctrine\Common\Collections\ArrayCollection;
  16. //use Doctrine\Common\Collections\Collection;
  17. use Symfony\Component\Validator\Context\ExecutionContextInterface;
  18. /**
  19.  * Reservation
  20.  *
  21.  * @ORM\Table(name="reservation")
  22.  * @ORM\Entity(repositoryClass="App\MDS\VenuesBundle\Repository\ReservationRepository")
  23.  * @ORM\HasLifecycleCallbacks
  24.  */
  25. class Reservation
  26. {
  27.     /**
  28.      * @var int
  29.      *
  30.      * @ORM\Column(name="id", type="integer")
  31.      * @ORM\Id
  32.      * @ORM\GeneratedValue(strategy="AUTO")
  33.      */
  34.     private $id;
  35.     /**
  36.      * @var string
  37.      *
  38.      * @ORM\Column(name="title", type="string", length=255)
  39.      * @Assert\NotBlank
  40.      */
  41.     private $title;
  42.     /**
  43.      * @ORM\ManyToOne(targetEntity=Client::class)
  44.      * @ORM\JoinColumn(name="client_id", referencedColumnName="id", nullable=true, onDelete="SET NULL")
  45.      */
  46.     private ?Client $client null;
  47.     /**
  48.      * @var string
  49.      *
  50.      * @ORM\Column(name="clientContact", type="string", length=255, nullable=true )
  51.      *
  52.      */
  53.     private $clientContact;
  54.     /**
  55.      * @var string
  56.      *
  57.      * @ORM\Column(name="contactUnregistered", type="string", length=255, nullable=true )
  58.      *
  59.      */
  60.     private $contactUnregistered;
  61.     /**
  62.      * @var string
  63.      *
  64.      * @ORM\Column(name="nameContactUnregistered", type="string", length=255, nullable=true )
  65.      *
  66.      */
  67.     private $nameContactUnregistered;
  68.     /**
  69.      * @var string
  70.      *
  71.      * @ORM\Column(name="phoneContactUnregistered", type="string", length=255, nullable=true )
  72.      *
  73.      */
  74.     private $phoneContactUnregistered;
  75.     /**
  76.      * @var \DateTimeInterface|null
  77.      *
  78.      * @ORM\Column(name="days", type="datetime", nullable=true)
  79.      */
  80.     private $days;
  81.     /**
  82.      * @var \DateTime
  83.      *
  84.      * @ORM\Column(name="createdAt", type="datetime")
  85.      */
  86.     private $createdAt;
  87.     /**
  88.      * @var string
  89.      *
  90.      * @ORM\Column(name="priority", type="string", length=255)
  91.      */
  92.     private $priority;
  93.     /**
  94.      * @var string
  95.      *
  96.      * @ORM\Column(name="createdBy", type="string", length=255)
  97.      */
  98.     private $createdBy;
  99.     /**
  100.      * @var string
  101.      *
  102.      * @ORM\Column(name="supplier", type="string", length=255, nullable=true)
  103.      */
  104.     private $supplier;
  105.     /**
  106.      * @var string
  107.      *
  108.      * @ORM\Column(name="status", type="string", length=255, nullable=true)
  109.      */
  110.     private $status;
  111.     /**
  112.      * @var \DateTime
  113.      *
  114.      * @ORM\Column(name="updatedAt", type="datetime")
  115.      */
  116.     private $updatedAt;
  117.     /**
  118.      * @var string
  119.      *
  120.      * @ORM\Column(name="updatedBy", type="string", length=255)
  121.      */
  122.     private $updatedBy;
  123.     /**
  124.      * @var int
  125.      *
  126.      * @ORM\Column(name="daysBlock", type="integer", nullable=true)
  127.      */
  128.     private $daysBlock;
  129.     /**
  130.      * @var \DateTime
  131.      *
  132.      * @ORM\Column(name="dateStart", type="datetime", nullable=true)
  133.      */
  134.     private $dateStart;
  135.     /**
  136.      * @var \DateTime
  137.      *
  138.      * @ORM\Column(name="dateEnd", type="datetime", nullable=true)
  139.      */
  140.     private $dateEnd;
  141.     /**
  142.      * @var int
  143.      *
  144.      * @ORM\Column(name="pax", type="integer", nullable=true)
  145.      */
  146.     private $pax;
  147.     /**
  148.      * @var string
  149.      *
  150.      * @ORM\Column(name="access_key", type="string", length=255, nullable=true)
  151.      */
  152.     private $accessKey;
  153.     /**
  154.      * @var string
  155.      *
  156.      * @ORM\Column(name="description", type="text", nullable=true)
  157.      */
  158.     private $description;
  159.     /**
  160.      * @var string
  161.      *
  162.      * @ORM\Column(name="contract", type="text", nullable=true)
  163.      */
  164.     private $contract;
  165.     /**
  166.      * @ORM\OneToOne(targetEntity=HtFile::class, mappedBy="reservation", cascade={"persist", "remove"})
  167.      * @Ignore
  168.      */
  169.     private $htFile;
  170.     /**
  171.      * @ORM\OneToOne(targetEntity=AveFiles::class, mappedBy="reservation", cascade={"persist","remove"})
  172.      */
  173.     private ?AveFiles $aveFile null;
  174.     /**
  175.      * @var string
  176.      *
  177.      * @ORM\Column(name="token", type="text", nullable=true)
  178.      */
  179.     private $token;
  180.     /**
  181.      * @var float
  182.      *
  183.      * @ORM\Column(name="comAvGp", type="float", nullable=true)
  184.      * Comisión que la empresa de Audiovisuales debe pagar a la empresa de Audiovisuales (10% por defecto)
  185.      */
  186.     private $comAvGp 10.0;
  187.     /**
  188.      * @var float
  189.      *
  190.      * @ORM\Column(name="comHtGp", type="float", nullable=true)
  191.      * Comisión que la empresa de Catering debe pagar a la empresa de Venues (14% por defecto)
  192.      */
  193.     private $comHtGp 14.0;
  194.     /**
  195.      * @ORM\Column(type="boolean", nullable=true)
  196.      */
  197.     private $sucoe;
  198.     /**
  199.      * @ORM\OneToMany(targetEntity=DocContract::class, mappedBy="reservation", orphanRemoval=true)
  200.      */
  201.     private $docContracts;
  202.     /**
  203.      * @ORM\Column(name="breakdown_packages", type="boolean", options={"default": false})
  204.      */
  205.     private bool $breakdownPackages false;
  206.     /**
  207.      * @ORM\Column(type="boolean", options={"default": false})
  208.      */
  209.     private bool $showPackagePrice false;
  210.     /**
  211.      * @var string
  212.      * Contiene la informacion que llega desde el formulario de la pagina web
  213.      *
  214.      * @ORM\Column(name="infoFormWeb", type="string", length=555, nullable=true)
  215.      *
  216.      */
  217.     private $infoFormWeb;
  218.     /**
  219.      * @var string
  220.      *
  221.      * @ORM\Column(name="mailToClient", type="text", nullable=true)
  222.      * Contiene el mensaje del email para enviar al cliente por la cotización web
  223.      */
  224.     private $mailToClient;
  225.     public function __construct()
  226.     {
  227.         $this->docContracts = new ArrayCollection();
  228.     }
  229.     public function getId(): ?int
  230.     {
  231.         return $this->id;
  232.     }
  233.     public function getTitle(): ?string
  234.     {
  235.         return $this->title;
  236.     }
  237.     public function setTitle(string $title): self
  238.     {
  239.         $this->title $title;
  240.         return $this;
  241.     }
  242.     public function getClient(): ?Client
  243.     {
  244.         return $this->client;
  245.     }
  246.     public function setClient(?Client $client): self
  247.     {
  248.         $this->client $client;
  249.         return $this;
  250.     }
  251.     public function getClientContact(): ?string
  252.     {
  253.         return $this->clientContact;
  254.     }
  255.     public function setClientContact(?string $clientContact): self
  256.     {
  257.         $this->clientContact $clientContact;
  258.         return $this;
  259.     }
  260.     public function getContactUnregistered(): ?string
  261.     {
  262.         return $this->contactUnregistered;
  263.     }
  264.     public function setContactUnregistered(?string $contactUnregistered): self
  265.     {
  266.         $this->contactUnregistered $contactUnregistered;
  267.         return $this;
  268.     }
  269.     public function getNameContactUnregistered(): ?string
  270.     {
  271.         return $this->nameContactUnregistered;
  272.     }
  273.     public function setNameContactUnregistered(?string $nameContactUnregistered): self
  274.     {
  275.         $this->nameContactUnregistered $nameContactUnregistered;
  276.         return $this;
  277.     }
  278.     public function getPhoneContactUnregistered(): ?string
  279.     {
  280.         return $this->phoneContactUnregistered;
  281.     }
  282.     public function setPhoneContactUnregistered(?string $phoneContactUnregistered): self
  283.     {
  284.         $this->phoneContactUnregistered $phoneContactUnregistered;
  285.         return $this;
  286.     }
  287.     public function getDays(): ?\DateTimeInterface
  288.     {
  289.         return $this->days;
  290.     }
  291.     public function setDays(?\DateTimeInterface $days): self
  292.     {
  293.         $this->days $days;
  294.         return $this;
  295.     }
  296.     public function getCreatedAt(): ?\DateTimeInterface
  297.     {
  298.         return $this->createdAt;
  299.     }
  300.     public function setCreatedAt(\DateTimeInterface $createdAt): self
  301.     {
  302.         $this->createdAt $createdAt;
  303.         return $this;
  304.     }
  305.     public function getPriority(): ?string
  306.     {
  307.         return $this->priority;
  308.     }
  309.     public function setPriority(string $priority): self
  310.     {
  311.         $this->priority $priority;
  312.         return $this;
  313.     }
  314.     public function getCreatedBy(): ?string
  315.     {
  316.         return $this->createdBy;
  317.     }
  318.     public function setCreatedBy(string $createdBy): self
  319.     {
  320.         $this->createdBy $createdBy;
  321.         return $this;
  322.     }
  323.     public function getSupplier(): ?string
  324.     {
  325.         return $this->supplier;
  326.     }
  327.     public function setSupplier(?string $supplier): self
  328.     {
  329.         $this->supplier $supplier;
  330.         return $this;
  331.     }
  332.     public function getStatus(): ?string
  333.     {
  334.         return $this->status;
  335.     }
  336.     public function setStatus(?string $status): self
  337.     {
  338.         $this->status $status;
  339.         return $this;
  340.     }
  341.     public function getUpdatedAt(): ?\DateTimeInterface
  342.     {
  343.         return $this->updatedAt;
  344.     }
  345.     public function setUpdatedAt(\DateTimeInterface $updatedAt): self
  346.     {
  347.         $this->updatedAt $updatedAt;
  348.         return $this;
  349.     }
  350.     public function getUpdatedBy(): ?string
  351.     {
  352.         return $this->updatedBy;
  353.     }
  354.     public function setUpdatedBy(string $updatedBy): self
  355.     {
  356.         $this->updatedBy $updatedBy;
  357.         return $this;
  358.     }
  359.     public function getDaysBlock(): ?int
  360.     {
  361.         return $this->daysBlock;
  362.     }
  363.     public function setDaysBlock(?int $daysBlock): self
  364.     {
  365.         $this->daysBlock $daysBlock;
  366.         return $this;
  367.     }
  368.     public function getDateStart(): ?\DateTimeInterface
  369.     {
  370.         return $this->dateStart;
  371.     }
  372.     public function setDateStart(?\DateTimeInterface $dateStart): self
  373.     {
  374.         $this->dateStart $dateStart;
  375.         return $this;
  376.     }
  377.     public function getDateEnd(): ?\DateTimeInterface
  378.     {
  379.         return $this->dateEnd;
  380.     }
  381.     public function setDateEnd(?\DateTimeInterface $dateEnd): self
  382.     {
  383.         $this->dateEnd $dateEnd;
  384.         return $this;
  385.     }
  386.     public function getPax(): ?int
  387.     {
  388.         return $this->pax;
  389.     }
  390.     public function setPax(?int $pax): self
  391.     {
  392.         $this->pax $pax;
  393.         return $this;
  394.     }
  395.     public function getAccessKey(): ?string
  396.     {
  397.         return $this->accessKey;
  398.     }
  399.     public function setAccessKey(?string $accessKey): self
  400.     {
  401.         $this->accessKey $accessKey;
  402.         return $this;
  403.     }
  404.     public function getDescription(): ?string
  405.     {
  406.         return $this->description;
  407.     }
  408.     public function setDescription(?string $description): self
  409.     {
  410.         $this->description $description;
  411.         return $this;
  412.     }
  413.     public function getContract(): ?string
  414.     {
  415.         return $this->contract;
  416.     }
  417.     public function setContract(?string $contract): self
  418.     {
  419.         $this->contract $contract;
  420.         return $this;
  421.     }
  422.     public function getHtFile(): ?HtFile
  423.     {
  424.         return $this->htFile;
  425.     }
  426.     public function setHtFile(?HtFile $htFile): self
  427.     {
  428.         // unset the owning side of the relation if necessary
  429.         if ($htFile === null && $this->htFile !== null) {
  430.             $this->htFile->setReservation(null);
  431.         }
  432.         // set the owning side of the relation if necessary
  433.         if ($htFile !== null && $htFile->getReservation() !== $this) {
  434.             $htFile->setReservation($this);
  435.         }
  436.         $this->htFile $htFile;
  437.         return $this;
  438.     }
  439.     public function getAveFile(): ?AveFiles
  440.     {
  441.         return $this->aveFile;
  442.     }
  443.     public function setAveFile(?AveFiles $aveFile): self
  444.     {
  445.         $this->aveFile $aveFile;
  446.         // Mantener sincronizada la otra cara
  447.         if ($aveFile && $aveFile->getReservation() !== $this) {
  448.             $aveFile->setReservation($this);
  449.         }
  450.         return $this;
  451.     }
  452.     public function getToken(): ?string
  453.     {
  454.         return $this->token;
  455.     }
  456.     public function setToken(?string $token): self
  457.     {
  458.         $this->token $token;
  459.         return $this;
  460.     }
  461.     public function isSucoe(): ?bool
  462.     {
  463.         return $this->sucoe;
  464.     }
  465.     public function setSucoe(?bool $sucoe): self
  466.     {
  467.         $this->sucoe $sucoe;
  468.         return $this;
  469.     }
  470.     /**
  471.      * @return Collection|DocContract[]
  472.      */
  473.     public function getDocContracts(): Collection
  474.     {
  475.         return $this->docContracts;
  476.     }
  477.     public function addDocContract(DocContract $docContract): self
  478.     {
  479.         if (!$this->docContracts->contains($docContract)) {
  480.             $this->docContracts[] = $docContract;
  481.             $docContract->setReservation($this);
  482.         }
  483.         return $this;
  484.     }
  485.     public function removeDocContract(DocContract $docContract): self
  486.     {
  487.         if ($this->docContracts->removeElement($docContract)) {
  488.             // set the owning side to null (unless already changed)
  489.             if ($docContract->getReservation() === $this) {
  490.                 // $docContract->setReservation(null); // No se puede poner a null porque es nullable=false
  491.             }
  492.         }
  493.         return $this;
  494.     }
  495.     /**
  496.      * @ORM\PrePersist
  497.      */
  498.     public function prePersist()
  499.     {
  500.         if (empty($this->createdAt)) {
  501.             $this->createdAt = new \DateTime();
  502.         }
  503.         if (empty($this->updatedAt)) {
  504.             $this->updatedAt = new \DateTime();
  505.         }
  506.     }
  507.     /**
  508.      * @ORM\PreUpdate
  509.      */
  510.     public function preUpdate()
  511.     {
  512.         $this->updatedAt = new \DateTime();
  513.     }
  514.     /**
  515.      * @Assert\Callback
  516.      */
  517.     public function validateContact(ExecutionContextInterface $context)
  518.     {
  519.         // Si NO hay contacto registrado Y el campo de nombre no registrado está vacío
  520.         if (null === $this->getClientContact() && empty($this->getNameContactUnregistered())) {
  521.             // Añadimos el error al campo específico
  522.             $context->buildViolation('Si no selecciona un contacto, debe indicar el nombre del contacto no registrado.')
  523.                 ->atPath('nameContactUnregistered')
  524.                 ->addViolation();
  525.         }
  526.     }
  527.     public function setComAvGp(?float $comAvGp): self
  528.     {
  529.         $this->comAvGp $comAvGp;
  530.         return $this;
  531.     }
  532.     public function getComAvGp(): ?float
  533.     {
  534.         return $this->comAvGp;
  535.     }
  536.     public function setComHtGp(?float $comHtGp): self
  537.     {
  538.         $this->comHtGp $comHtGp;
  539.         return $this;
  540.     }
  541.     public function getComHtGp(): ?float
  542.     {
  543.         return $this->comHtGp;
  544.     }
  545.     /**
  546.      * @return bool
  547.      */
  548.     public function isBreakdownPackages(): bool
  549.     {
  550.         return $this->breakdownPackages;
  551.     }
  552.     /**
  553.      * @param bool $breakdownPackages
  554.      * @return self
  555.      */
  556.     public function setBreakdownPackages(bool $breakdownPackages): self
  557.     {
  558.         $this->breakdownPackages $breakdownPackages;
  559.         return $this;
  560.     }
  561.         /**
  562.      * @return bool
  563.      */
  564.     public function getShowPackagePrice(): bool
  565.     {
  566.         return $this->showPackagePrice;
  567.     }
  568.     /**
  569.      * @param bool $showPackagePrice
  570.      * @return self
  571.      */
  572.     public function setShowPackagePrice(bool $showPackagePrice): self
  573.     {
  574.         $this->showPackagePrice $showPackagePrice;
  575.         return $this;
  576.     }
  577.     /**
  578.      * Set infoFormWeb
  579.      *
  580.      * @param string $infoFormWeb
  581.      * @return self
  582.      */
  583.     public function setInfoFormWeb($infoFormWeb)
  584.     {
  585.         $this->infoFormWeb $infoFormWeb;
  586.         return $this;
  587.     }
  588.     /**
  589.      * Get infoFormWeb
  590.      * @return string
  591.      */
  592.     public function getInfoFormWeb()
  593.     {
  594.         return $this->infoFormWeb;
  595.     }
  596.     /**
  597.      * Set mailToClient
  598.      *
  599.      * @param string $mailToClient
  600.      * @return self
  601.      */
  602.     public function setMailToClient($mailToClient)
  603.     {
  604.         $this->mailToClient $mailToClient;
  605.         return $this;
  606.     }
  607.     /**
  608.      * Get mailToClient
  609.      * @return string
  610.      */
  611.     public function getMailToClient()
  612.     {
  613.         return $this->mailToClient;
  614.     }
  615. }