src/Entity/FranjaDias.php line 380
- <?php
- namespace App\Entity;
- use Doctrine\Common\Collections\Collection;
- use Doctrine\ORM\Mapping as ORM;
- use Doctrine\Common\Collections\ArrayCollection;
- use Symfony\Component\Validator\Constraints as Assert;
- use JsonSerializable;
- use Knp\DoctrineBehaviors\Contract\Entity\TranslatableInterface;
- use Knp\DoctrineBehaviors\Model\Translatable\TranslatableTrait;
- /**
- * FranjaDias
- *
- * @ORM\Table(name="franja_dias")
- * @ORM\Entity
- */
- class FranjaDias implements \JsonSerializable, TranslatableInterface
- {
- use TranslatableTrait;
- /**
- * @var integer
- *
- * @ORM\Column(name="id", type="integer")
- * @ORM\Id
- * @ORM\GeneratedValue(strategy="AUTO")
- */
- private $id;
- /**
- * @var boolean
- *
- * @ORM\Column(name="lunes", type="boolean")
- */
- private $lunes;
- /**
- * @var boolean
- *
- * @ORM\Column(name="martes", type="boolean")
- */
- private $martes;
- /**
- * @var boolean
- *
- * @ORM\Column(name="miercoles", type="boolean")
- */
- private $miercoles;
- /**
- * @var boolean
- *
- * @ORM\Column(name="jueves", type="boolean")
- */
- private $jueves;
- /**
- * @var boolean
- *
- * @ORM\Column(name="viernes", type="boolean")
- */
- private $viernes;
- /**
- * @var boolean
- *
- * @ORM\Column(name="sabado", type="boolean")
- */
- private $sabado;
- /**
- * @var boolean
- *
- * @ORM\Column(name="domingo", type="boolean")
- */
- private $domingo;
- /**
- * @Assert\Valid()
- * @ORM\OneToMany(targetEntity="FranjaHoras", mappedBy="franjaDias", cascade={"persist", "remove"}, orphanRemoval=true)
- */
- private $franjaHoras;
- /**
- * @ORM\ManyToOne(targetEntity="Oficina", inversedBy="franjas"))
- * @ORM\JoinColumn(name="oficina", referencedColumnName="id")
- */
- private $oficina;
- public function __call($method, $args)
- {
- //return $this->proxyCurrentLocaleTranslation($method, $arguments);
- if (!method_exists(self::getTranslationEntityClass(), $method)) {
- $method = 'get'. ucfirst($method);
- }
- return $this->proxyCurrentLocaleTranslation($method, $args);
- }
- public function __construct() {
- $this->franjaHoras = new ArrayCollection();
- }
- /**
- * Get id
- *
- * @return integer
- */
- public function getId()
- {
- return $this->id;
- }
- /**
- * Set lunes
- *
- * @param boolean $lunes
- * @return FranjaDias
- */
- public function setLunes($lunes)
- {
- $this->lunes = $lunes;
- return $this;
- }
- /**
- * Get lunes
- *
- * @return boolean
- */
- public function getLunes()
- {
- return $this->lunes;
- }
- /**
- * Set martes
- *
- * @param boolean $martes
- * @return FranjaDias
- */
- public function setMartes($martes)
- {
- $this->martes = $martes;
- return $this;
- }
- /**
- * Get martes
- *
- * @return boolean
- */
- public function getMartes()
- {
- return $this->martes;
- }
- /**
- * Set miercoles
- *
- * @param boolean $miercoles
- * @return FranjaDias
- */
- public function setMiercoles($miercoles)
- {
- $this->miercoles = $miercoles;
- return $this;
- }
- /**
- * Get miercoles
- *
- * @return boolean
- */
- public function getMiercoles()
- {
- return $this->miercoles;
- }
- /**
- * Set jueves
- *
- * @param boolean $jueves
- * @return FranjaDias
- */
- public function setJueves($jueves)
- {
- $this->jueves = $jueves;
- return $this;
- }
- /**
- * Get jueves
- *
- * @return boolean
- */
- public function getJueves()
- {
- return $this->jueves;
- }
- /**
- * Set viernes
- *
- * @param boolean $viernes
- * @return FranjaDias
- */
- public function setViernes($viernes)
- {
- $this->viernes = $viernes;
- return $this;
- }
- /**
- * Get viernes
- *
- * @return boolean
- */
- public function getViernes()
- {
- return $this->viernes;
- }
- /**
- * Set sabado
- *
- * @param boolean $sabado
- * @return FranjaDias
- */
- public function setSabado($sabado)
- {
- $this->sabado = $sabado;
- return $this;
- }
- /**
- * Get sabado
- *
- * @return boolean
- */
- public function getSabado()
- {
- return $this->sabado;
- }
- /**
- * Set domingo
- *
- * @param boolean $domingo
- * @return FranjaDias
- */
- public function setDomingo($domingo)
- {
- $this->domingo = $domingo;
- return $this;
- }
- /**
- * Get domingo
- *
- * @return boolean
- */
- public function getDomingo()
- {
- return $this->domingo;
- }
- /**
- * Set oficina
- *
- * @param Oficina $oficina
- * @return FranjaDias
- */
- public function setOficina(Oficina $oficina)
- {
- $this->oficina = $oficina;
- return $this;
- }
- /**
- * Get oficina
- *
- * @return boolean
- */
- public function getOficina()
- {
- return $this->oficina;
- }
- /**
- * Get dias
- *
- * @return array
- */
- public function getFranjaDias()
- {
- $semana['lunes']=$this->lunes;
- $semana['martes']=$this->martes;
- $semana['miercoles']=$this->miercoles;
- $semana['jueves']=$this->jueves;
- $semana['viernes']=$this->viernes;
- $semana['sabado']=$this->sabado;
- $semana['domingo']=$this->domingo;
- foreach ($this->franjaHoras as $franja){
- $semana['franjas'][]=json_encode($franja->getFranjaHoras());
- }
- foreach ($this->translations as $traduccion) {
- $semana['traducciones'][]=$traduccion->getNombre();
- }
- return $semana;
- }
- /**
- * Set franjaHoras
- *
- * @param ArrayColection $franjaHoras
- * @return FranjaDias
- */
- public function setFranjaHoras($franjaHoras)
- {
- $this->franjaHoras=$franjaHoras;
- return $this;
- }
- /**
- * Get nombre
- *
- * @return franjaHoras
- */
- public function getFranjaHoras()
- {
- return $this->franjaHoras;
- }
- /**
- * Set dias
- *
- * @param array $semana
- * @return FranjaDias
- */
- public function setDias($semana)
- {
- $this->lunes=$semana['lunes'];
- $this->martes=$semana['martes'];
- $this->miercoles=$semana['miercoles'];
- $this->jueves=$semana['jueves'];
- $this->viernes=$semana['viernes'];
- $this->sabado=$semana['sabado'];
- $this->domingo=$semana['domingo'];
- return $this;
- }
- public function __toString(){
- return (string) $this->id;
- }
- public function jsonSerialize()
- {
- return array(
- 'lunes' => $this->lunes,
- 'martes'=> $this->martes,
- 'miercoles'=> $this->miercoles,
- 'jueves'=> $this->jueves,
- 'viernes'=> $this->viernes,
- 'sabado'=> $this->sabado,
- 'domingo'=> $this->domingo,
- 'id' => $this->id,
- 'franjaHoras' => json_encode($this->franjaHoras)
- );
- }
- public function isLunes(): ?bool
- {
- return $this->lunes;
- }
- public function isMartes(): ?bool
- {
- return $this->martes;
- }
- public function isMiercoles(): ?bool
- {
- return $this->miercoles;
- }
- public function isJueves(): ?bool
- {
- return $this->jueves;
- }
- public function isViernes(): ?bool
- {
- return $this->viernes;
- }
- public function isSabado(): ?bool
- {
- return $this->sabado;
- }
- public function isDomingo(): ?bool
- {
- return $this->domingo;
- }
- public function addFranjaHora(FranjaHoras $franjaHora): self
- {
- if (!$this->franjaHoras->contains($franjaHora)) {
- $this->franjaHoras->add($franjaHora);
- $franjaHora->setFranjaDias($this);
- }
- return $this;
- }
- public function removeFranjaHora(FranjaHoras $franjaHora): self
- {
- if ($this->franjaHoras->removeElement($franjaHora)) {
- // set the owning side to null (unless already changed)
- if ($franjaHora->getFranjaDias() === $this) {
- $franjaHora->setFranjaDias(null);
- }
- }
- return $this;
- }
- }