/** * método para salvar vinculo entre artefatos * @param \Core_Dto_Search $dto */ public function addDocumentoEletronico(\Core_Dto_Search $dto) { $entity = NULL; if ($dto->getSqTipoArtefato() == 2) { //Processo $artefato = $this->_getRepository('app:Artefato')->findBy(array('nuArtefato' => $dto->getNuArtefatoVinculacao())); } else { //Dossie Referencia e vinculo entre documentos $artefato = $this->_getRepository('app:Artefato')->findBy(array('nuDigital' => $dto->getNuDigital())); } if ($artefato) { $sqArtefatoPai = $this->_getRepository('app:Artefato')->find($dto->getSqArtefato()); $sqArtefatoFilho = $this->_getRepository()->find($artefato[0]->getSqArtefato()); $sqTipoVinculo = $this->_getRepository('app:TipoVinculoArtefato')->find($dto->getTipoVinculo()); $entity = new \Sgdoce\Model\Entity\ArtefatoVinculo(); $entity->setSqArtefatoPai($sqArtefatoPai); $entity->setSqArtefatoFilho($sqArtefatoFilho); $entity->setSqTipoVinculoArtefato($sqTipoVinculo); $entity->setDtVinculo(\Zend_Date::now()); if ($dto->getInOriginal()) { $entity->setInOriginal($dto->getInOriginal()); } else { $entity->setInOriginal(FALSE); } $this->getEntityManager()->persist($entity); $this->getEntityManager()->flush($entity); } return $entity; }