src/Application/Internit/IntegracaoBundle/Sienge/Entity/Empreendimento.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Application\Internit\IntegracaoBundle\Sienge\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use App\Application\Internit\IntegracaoBundle\Sienge\Repository\EmpreendimentoRepository;
  7. /**
  8.  * Empreendimento - Cache local de empreendimentos sincronizados do Sienge
  9.  */
  10. #[ORM\Table(name'integracao_sienge_empreendimento')]
  11. #[ORM\Entity(repositoryClassEmpreendimentoRepository::class)]
  12. class Empreendimento
  13. {
  14.     #[ORM\Id]
  15.     #[ORM\GeneratedValue]
  16.     #[ORM\Column(name'id'type'integer'uniquetruenullablefalse)]
  17.     private ?int $id null;
  18.     /**
  19.      * ID do contrato do Sienge
  20.      */
  21.     #[ORM\Column(name'sienge_contract_id'type'string'length255nullablefalseuniquetrue)]
  22.     private string $siengeContractId;
  23.     /**
  24.      * ID da empresa do Sienge
  25.      */
  26.     #[ORM\Column(name'sienge_company_id'type'string'length255nullabletrue)]
  27.     private ?string $siengeCompanyId null;
  28.     /**
  29.      * ID da obra/edifício do Sienge
  30.      */
  31.     #[ORM\Column(name'sienge_building_id'type'string'length255nullabletrue)]
  32.     private ?string $siengeBuildingId null;
  33.     /**
  34.      * Nome do empreendimento
  35.      */
  36.     #[ORM\Column(name'nome'type'string'length255nullabletrue)]
  37.     private ?string $nome null;
  38.     /**
  39.      * Descrição da obra
  40.      */
  41.     #[ORM\Column(name'descricao'type'text'nullabletrue)]
  42.     private ?string $descricao null;
  43.     /**
  44.      * Endereço
  45.      */
  46.     #[ORM\Column(name'endereco'type'string'length255nullabletrue)]
  47.     private ?string $endereco null;
  48.     /**
  49.      * Cidade
  50.      */
  51.     #[ORM\Column(name'cidade'type'string'length100nullabletrue)]
  52.     private ?string $cidade null;
  53.     /**
  54.      * Estado
  55.      */
  56.     #[ORM\Column(name'estado'type'string'length2nullabletrue)]
  57.     private ?string $estado null;
  58.     /**
  59.      * CEP
  60.      */
  61.     #[ORM\Column(name'cep'type'string'length10nullabletrue)]
  62.     private ?string $cep null;
  63.     /**
  64.      * Data de sincronização
  65.      */
  66.     #[ORM\Column(name'data_sincronizacao'type'datetime'nullablefalse)]
  67.     private \DateTimeInterface $dataSincronizacao;
  68.     /**
  69.      * Relacionamento com unidades
  70.      *
  71.      * @var Collection<int, Unidade>
  72.      */
  73.     #[ORM\OneToMany(targetEntityUnidade::class, mappedBy'empreendimento'cascade: ['persist''remove'])]
  74.     private Collection $unidades;
  75.     public function __construct()
  76.     {
  77.         $this->unidades = new ArrayCollection();
  78.         $this->dataSincronizacao = new \DateTime();
  79.     }
  80.     public function getId(): ?int
  81.     {
  82.         return $this->id;
  83.     }
  84.     public function getSiengeContractId(): string
  85.     {
  86.         return $this->siengeContractId;
  87.     }
  88.     public function setSiengeContractId(string $siengeContractId): self
  89.     {
  90.         $this->siengeContractId $siengeContractId;
  91.         return $this;
  92.     }
  93.     public function getSiengeCompanyId(): ?string
  94.     {
  95.         return $this->siengeCompanyId;
  96.     }
  97.     public function setSiengeCompanyId(?string $siengeCompanyId): self
  98.     {
  99.         $this->siengeCompanyId $siengeCompanyId;
  100.         return $this;
  101.     }
  102.     /**
  103.      * Alias semântico para getSiengeCompanyId() - usado em requisições de Imposto de Renda
  104.      * Retorna o ID da empresa do Sienge que pode ser usada como 'companyId' em APIs externas
  105.      */
  106.     public function getCompanyId(): ?string
  107.     {
  108.         return $this->siengeCompanyId;
  109.     }
  110.     public function getSiengeBuildingId(): ?string
  111.     {
  112.         return $this->siengeBuildingId;
  113.     }
  114.     public function setSiengeBuildingId(?string $siengeBuildingId): self
  115.     {
  116.         $this->siengeBuildingId $siengeBuildingId;
  117.         return $this;
  118.     }
  119.     public function getNome(): ?string
  120.     {
  121.         return $this->nome;
  122.     }
  123.     public function setNome(?string $nome): self
  124.     {
  125.         $this->nome $nome;
  126.         return $this;
  127.     }
  128.     public function getDescricao(): ?string
  129.     {
  130.         return $this->descricao;
  131.     }
  132.     public function setDescricao(?string $descricao): self
  133.     {
  134.         $this->descricao $descricao;
  135.         return $this;
  136.     }
  137.     public function getEndereco(): ?string
  138.     {
  139.         return $this->endereco;
  140.     }
  141.     public function setEndereco(?string $endereco): self
  142.     {
  143.         $this->endereco $endereco;
  144.         return $this;
  145.     }
  146.     public function getCidade(): ?string
  147.     {
  148.         return $this->cidade;
  149.     }
  150.     public function setCidade(?string $cidade): self
  151.     {
  152.         $this->cidade $cidade;
  153.         return $this;
  154.     }
  155.     public function getEstado(): ?string
  156.     {
  157.         return $this->estado;
  158.     }
  159.     public function setEstado(?string $estado): self
  160.     {
  161.         $this->estado $estado;
  162.         return $this;
  163.     }
  164.     public function getCep(): ?string
  165.     {
  166.         return $this->cep;
  167.     }
  168.     public function setCep(?string $cep): self
  169.     {
  170.         $this->cep $cep;
  171.         return $this;
  172.     }
  173.     public function getDataSincronizacao(): \DateTimeInterface
  174.     {
  175.         return $this->dataSincronizacao;
  176.     }
  177.     public function setDataSincronizacao(\DateTimeInterface $dataSincronizacao): self
  178.     {
  179.         $this->dataSincronizacao $dataSincronizacao;
  180.         return $this;
  181.     }
  182.     /**
  183.      * @return Collection<int, Unidade>
  184.      */
  185.     public function getUnidades(): Collection
  186.     {
  187.         return $this->unidades;
  188.     }
  189.     public function addUnidade(Unidade $unidade): self
  190.     {
  191.         if (!$this->unidades->contains($unidade)) {
  192.             $this->unidades->add($unidade);
  193.             $unidade->setEmpreendimento($this);
  194.         }
  195.         return $this;
  196.     }
  197.     public function removeUnidade(Unidade $unidade): self
  198.     {
  199.         if ($this->unidades->removeElement($unidade)) {
  200.             if ($unidade->getEmpreendimento() === $this) {
  201.                 $unidade->setEmpreendimento(null);
  202.             }
  203.         }
  204.         return $this;
  205.     }
  206. }