public function addArtefatoVinculo(\Core_Dto_Search $dto) { $entity = NULL; $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; }