src/Entity/Reserva.php line 20
- <?php
- namespace App\Entity;
- use App\Entity\UserStats;
- use Doctrine\ORM\Mapping as ORM;
- use App\Entity\User;
- use Doctrine\Common\Collections\ArrayCollection;
- use JMS\Serializer\Annotation as JMS;
- use Dinamic\ShopBundle\Entity\Cupon;
- use Symfony\Component\Validator\Constraints as Assert;
- /**
- * Reserva
- *
- * @ORM\Table(name="reserva")
- * @ORM\Entity(repositoryClass="App\Repository\ReservaRepository")
- */
- class Reserva
- {
- /**
- * @var integer
- *
- * @ORM\Column(name="id", type="integer")
- * @ORM\Id
- * @ORM\GeneratedValue(strategy="AUTO")
- * @JMS\Groups({"api-stats"})
- */
- private $id;
- /**
- * @ORM\ManyToOne(targetEntity="Oficina", inversedBy="reservas")
- * @ORM\JoinColumn(name="oficina", referencedColumnName="id", nullable=true)
- */
- private $oficina;
- /**
- * @var string
- *
- * @ORM\Column(name="cupon", type="string", length=255, nullable=false)
- */
- private $cupon;
- /**
- * @ORM\ManyToOne(targetEntity="App\Entity\User", inversedBy="reservas")
- * @ORM\JoinColumn(name="usuario", referencedColumnName="id", nullable=true)
- */
- private $usuario;
- /**
- * @var string
- *
- * @ORM\Column(name="anotacion", type="string", length=255, nullable=true)
- */
- private $anotacion;
- /**
- * @var string
- *
- * @ORM\Column(name="estado", type="string", length=255, nullable=true)
- */
- private $estado;
- /**
- * @var \DateTime
- *
- * @ORM\Column(name="horaRecogida", type="time", nullable=true)
- */
- private $horaRecogida;
- /**
- * @ORM\OneToMany(targetEntity="ReservaLinea", mappedBy="reserva", cascade={"persist", "remove"}, orphanRemoval=true)
- */
- private $lineas;
- /**
- * @var \DateTime
- *
- * @ORM\Column(name="fechaRecogida", type="date", nullable=true)
- */
- private $fechaRecogida;
- /**
- * @var string
- *
- * @ORM\Column(name="nombre", type="string", length=255, nullable=true)
- */
- private $nombre;
- /**
- * @var string
- *
- * @ORM\Column(name="apellido", type="string", length=255, nullable=true)
- */
- private $apellido;
- /**
- * @var string
- *
- * @ORM\Column(name="telefono", type="string", length=255, nullable=true)
- */
- private $telefono;
- /**
- * @var string
- *
- * @ORM\Column(name="email", type="string", length=255, nullable=true)
- */
- private $email;
- /**
- * @var string
- *
- * @ORM\Column(name="fechaOperacion", type="datetime", nullable=true)
- */
- private $fechaOperacion;
- /**
- * @var UserStats[]
- * @ORM\ManyToMany(targetEntity="UserStats", mappedBy="bookingConversions")
- *
- */
- protected $userStats;
- public function __toString() {
- return "reserva ".$this->getId();
- }
- public function __construct() {
- $this->lineas = new ArrayCollection();
- $this->fechaOperacion = new \DateTime();
- $this->userStats = new ArrayCollection();
- }
- /**
- * Get id
- *
- * @return integer
- */
- public function getId()
- {
- return $this->id;
- }
- /**
- * Set oficina
- *
- * @param Oficina $oficina
- * @return Reserva
- */
- public function setOficina(Oficina $oficina)
- {
- $this->oficina = $oficina;
- return $this;
- }
- /**
- * Get oficina
- *
- * @return Oficina
- */
- public function getOficina()
- {
- return $this->oficina;
- }
- /**
- * Set cupon
- *
- * @param string $cupon
- * @return Transaccion
- */
- public function setCupon($cupon)
- {
- $this->cupon = $cupon;
- return $this;
- }
- /**
- * Get cupon
- *
- * @return Cupon
- */
- public function getCupon()
- {
- return $this->cupon;
- }
- /**
- * Set dia
- *
- * @param \DateTime $dia
- * @return Reserva
- */
- public function setDia($dia)
- {
- $this->dia = $dia;
- return $this;
- }
- /**
- * Get dia
- *
- * @return \DateTime
- */
- public function getDia()
- {
- return $this->dia;
- }
- /**
- * Set estado
- *
- * @param string $estado
- * @return Reserva
- */
- public function setEstado($estado)
- {
- $this->estado = $estado;
- return $this;
- }
- /**
- * Get estado
- *
- * @return string
- */
- public function getEstado()
- {
- return $this->estado;
- }
- /**
- * Set usuario
- *
- * @param User $usuario
- * @return Reserva
- */
- public function setUsuario(User $usuario)
- {
- $this->usuario = $usuario;
- return $this;
- }
- /**
- * Get usuario
- *
- * @return User
- */
- public function getUsuario()
- {
- return $this->usuario;
- }
- /**
- * Set anotacion
- *
- * @param string $anotacion
- * @return Reserva
- */
- public function setAnotacion($anotacion)
- {
- $this->anotacion = $anotacion;
- return $this;
- }
- /**
- * Get anotacion
- *
- * @return string
- */
- public function getAnotacion()
- {
- return $this->anotacion;
- }
- /**
- * Set linea
- *
- * @param Linea $lineas
- * @return Reserva
- */
- public function setLineas($lineas)
- {
- $this->lineas = $lineas;
- return $this;
- }
- /**
- * Get lineas
- *
- * @return string
- */
- public function getLineas()
- {
- return $this->lineas;
- }
- /**
- * Set lineas
- *
- * @param Linea $lineas
- * @return Reserva
- */
- public function addLinea($linea)
- {
- $this->lineas[] = $linea;
- $linea->setReserva($this);
- return $this;
- }
- /**
- * Get lineas
- *
- * @return Reserva
- */
- public function removeLinea($linea)
- {
- $this->franjas->removeElement($linea);
- return $this;
- }
- /**
- * Set horaRecogida
- *
- * @param time $horaRecogida
- * @return Reserva
- */
- public function setHoraRecogida($horaRecogida)
- {
- $this->horaRecogida = $horaRecogida;
- return $this;
- }
- /**
- * Get horaRecogida
- *
- * @return \DateTime
- */
- public function getHoraRecogida()
- {
- return $this->horaRecogida;
- }
- /**
- * Set fechaRecogida
- *
- * @param \DateTime $fechaRecogida
- * @return Pedido
- */
- public function setFechaRecogida($fechaRecogida)
- {
- $this->fechaRecogida = $fechaRecogida;
- return $this;
- }
- /**
- * Get fechaRecogida
- *
- * @return \DateTime
- */
- public function getFechaRecogida()
- {
- return $this->fechaRecogida;
- }
- /**
- * Set nombre
- *
- * @param string $nombre
- * @return Reserva
- */
- public function setNombre($nombre)
- {
- $this->nombre = $nombre;
- return $this;
- }
- /**
- * Get nombre
- *
- * @return string
- */
- public function getNombre()
- {
- return $this->nombre;
- }
- /**
- * Set apellido
- *
- * @param string $apellido
- * @return Reserva
- */
- public function setApellido($apellido)
- {
- $this->apellido = $apellido;
- return $this;
- }
- /**
- * Get apellido
- *
- * @return string
- */
- public function getApellido()
- {
- return $this->apellido;
- }
- /**
- * Set telefono
- *
- * @param string $telefono
- * @return Reserva
- */
- public function setTelefono($telefono)
- {
- $this->telefono = $telefono;
- return $this;
- }
- /**
- * Get telefono
- *
- * @return string
- */
- public function getTelefono()
- {
- return $this->telefono;
- }
- /**
- * Set email
- *
- * @param string $email
- * @return Reserva
- */
- public function setEmail($email)
- {
- $this->email = $email;
- return $this;
- }
- /**
- * Get email
- *
- * @return string
- */
- public function getEmail()
- {
- return $this->email;
- }
- /**
- * Set fechaOperacion
- *
- * @param string $fechaOperacion
- * @return Transaccion
- */
- public function setFechaOperacion($fechaOperacion)
- {
- $this->fechaOperacion = $fechaOperacion;
- return $this;
- }
- /**
- * Get fechaOperacion
- *
- * @return \DateTime
- */
- public function getFechaOperacion()
- {
- return $this->fechaOperacion;
- }
- /**
- * @return UserStats[]
- */
- public function getUserStats()
- {
- return $this->userStats;
- }
- /**
- * @param UserStats[] $userStats
- */
- public function setUserStats($userStats)
- {
- $this->userStats = $userStats;
- }
- public function lineasHtml()
- {
- $html = '
- <table class="table">
- <tbody>
- <tr class="sonata-ba-view-container">
- <th>Cantidad</th>
- <th>Divisa Origen</th>
- <th>Divisa Destino</th>
- </tr>';
- foreach ($this->getLineas() as $linea)
- {
- $html .= '<tr><td>'.$linea->getCantidad().'</td><td>'.$linea->getDivisaOrigen().'</td><td>'.$linea->getDivisaDestino().'</td></tr>';
- }
- $html .= '</tbody>
- </table>';
- return $html;
- }
- }