コード例 #1
0
 public function getArrayDados()
 {
     $estado = (new EstadosDAO())->getById($this->dto->getEstado());
     $cidade = (new CidadesDAO())->getById($this->dto->getCidade());
     $endereco = (new CategoriaValorDAO())->getBy2Ids($this->dto->getCdVlCatgEnd(), 9)->getDescVlCatg();
     $pessoaJuridica = (new PessoaJuridicaDAO())->getById($this->dto->getCdPessoaJuridica())->getNmFantasia();
     return array('id_endereco' => $this->dto->getNrSequencia(), 'categoria' => $endereco, 'cd_catg_end' => $this->dto->getCdCatgEnd(), 'cd_vl_catg_end' => $this->dto->getCdVlCatgEnd(), 'cd_pessoa_juridica' => $this->dto->getCdPessoaJuridica(), 'empresa' => $pessoaJuridica, 'cep' => $this->dto->getCep(), 'rua' => $this->dto->getRua(), 'numero' => $this->dto->getNumero(), 'bairro' => $this->dto->getBairro(), 'cidade' => $cidade->getNome(), 'id_cidade' => $cidade->getId(), 'estado' => $estado->getNome(), 'id_estado' => $estado->getId(), 'observacao' => $this->dto->getObservacao());
 }
コード例 #2
0
 /**
  * @param PessoaJuridicaEnderecoDTO $dto
  * @return bool|DataTransferObject
  * @throws Exception
  */
 public function gravar(PessoaJuridicaEnderecoDTO $dto)
 {
     if ($dto->getNrSequencia() == '') {
         if (!($obj = $this->insert($dto))) {
             throw new Exception('Impossível Inserir Endereço');
         }
     } else {
         if (!($obj = $this->update($dto))) {
             throw new Exception('Impossível Atualizar Endereço');
         }
     }
     return $obj;
 }