/** * @return array */ public function getArrayDados() { $pessoaModel = new PessoaFisicaModel(); $pessoa = $pessoaModel->getDAO()->getById($this->dto->getCdPessoaFisica()); $pessoaInfo = $pessoaModel->setDTO($pessoa)->getArrayDados(); $ocorrenciaModel = new OcorrenciaModel(); $ocorrencia = $ocorrenciaModel->getDAO()->getById($this->dto->getCdOcorrencia()); $ocorrenciaInfo = $ocorrenciaModel->setDTO($ocorrencia)->getArrayDados(); return array_merge($ocorrenciaInfo, $pessoaInfo); }
/** * @param OcorrenciaPessoaFisicaEnvolvidaDTO $dto * @return array|bool|DataTransferObject * @throws Exception */ public function gravar(OcorrenciaPessoaFisicaEnvolvidaDTO $dto) { if (!$this->getBy2Ids($dto->getCdOcorrencia(), $dto->getCdPessoaFisica())) { if (!($obj = $this->insert($dto))) { throw new Exception('Impossível Gravar Ocorrencia de Pessoa Fisica Envolvida'); } } else { $obj = array('msg' => 'Registro já existe!'); } return $obj; }