vendor/novosga/core/Entity/Unidade.php line 161

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of the Novo SGA project.
  4.  *
  5.  * (c) Rogerio Lino <rogeriolino@gmail.com>
  6.  *
  7.  * For the full copyright and license information, please view the LICENSE
  8.  * file that was distributed with this source code.
  9.  */
  10. namespace Novosga\Entity;
  11. /**
  12.  * Unidade de atendimento.
  13.  *
  14.  * @author Rogerio Lino <rogeriolino@gmail.com>
  15.  */
  16. class Unidade implements \JsonSerializable
  17. {
  18.     /**
  19.      * @var mixed
  20.      */
  21.     protected $id;
  22.     
  23.     /**
  24.      * @var string
  25.      */
  26.     private $nome;
  27.     /**
  28.      * @var string
  29.      */
  30.     private $descricao;
  31.     /**
  32.      * @var bool
  33.      */
  34.     private $ativo;
  35.     /**
  36.      * @var ConfiguracaoImpressao
  37.      */
  38.     private $impressao;
  39.     /**
  40.      * @var \DateTime
  41.      */
  42.     private $createdAt;
  43.     /**
  44.      * @var \DateTime
  45.      */
  46.     private $updatedAt;
  47.     /**
  48.      * @var \DateTime
  49.      */
  50.     private $deletedAt;
  51.     public function __construct()
  52.     {
  53.         $this->ativo true;
  54.         $this->impressao = new ConfiguracaoImpressao($this);
  55.     }
  56.     
  57.     public function getId()
  58.     {
  59.         return $this->id;
  60.     }
  61.     public function setId($id): self
  62.     {
  63.         $this->id $id;
  64.         return $this;
  65.     }
  66.     
  67.     public function getDescricao()
  68.     {
  69.         return $this->descricao;
  70.     }
  71.     public function setDescricao($descricao): self
  72.     {
  73.         $this->descricao $descricao;
  74.         return $this;
  75.     }
  76.     
  77.     public function setNome($nome): self
  78.     {
  79.         $this->nome $nome;
  80.         return $this;
  81.     }
  82.     public function getNome()
  83.     {
  84.         return $this->nome;
  85.     }
  86.     public function isAtivo(): bool
  87.     {
  88.         return $this->ativo;
  89.     }
  90.     public function setAtivo(bool $ativo): self
  91.     {
  92.         $this->ativo $ativo;
  93.         return $this;
  94.     }
  95.     public function getImpressao()
  96.     {
  97.         return $this->impressao;
  98.     }
  99.     
  100.     public function getCreatedAt()
  101.     {
  102.         return $this->createdAt;
  103.     }
  104.     public function getUpdatedAt()
  105.     {
  106.         return $this->updatedAt;
  107.     }
  108.     public function getDeletedAt()
  109.     {
  110.         return $this->deletedAt;
  111.     }
  112.     public function setCreatedAt(\DateTime $createdAt): self
  113.     {
  114.         $this->createdAt $createdAt;
  115.         return $this;
  116.     }
  117.     public function setUpdatedAt(\DateTime $updatedAt): self
  118.     {
  119.         $this->updatedAt $updatedAt;
  120.         return $this;
  121.     }
  122.     public function setDeletedAt(\DateTime $deletedAt): self
  123.     {
  124.         $this->deletedAt $deletedAt;
  125.         
  126.         return $this;
  127.     }
  128.     
  129.     public function __toString()
  130.     {
  131.         return $this->getNome();
  132.     }
  133.     public function jsonSerialize()
  134.     {
  135.         return [
  136.             'id'        => $this->getId(),
  137.             'nome'      => $this->getNome(),
  138.             'descricao' => $this->getDescricao(),
  139.             'ativo'     => $this->isAtivo(),
  140.             'impressao' => $this->getImpressao(),
  141.             'createdAt' => $this->getCreatedAt() ? $this->getCreatedAt()->format('Y-m-d\TH:i:s') : null,
  142.             'updatedAt' => $this->getUpdatedAt() ? $this->getUpdatedAt()->format('Y-m-d\TH:i:s') : null,
  143.             'deletedAt' => $this->getDeletedAt() ? $this->getDeletedAt()->format('Y-m-d\TH:i:s') : null,
  144.         ];
  145.     }
  146. }