Example #1
0
 /**
  * método salvar vinculo de material de apoio dos artefatos
  * @param \Core_Dto_Search $dto
  */
 public function salvarMaterial(\Core_Dto_Search $dto)
 {
     $criteria = array('nuDigital' => $dto->getNuDigital());
     $artefato = $this->_getRepository('app:Artefato')->findOneBy($criteria);
     $sqArtefatoPai = $this->_getRepository()->find($dto->getSqArtefato());
     $sqArtefatoFilho = $this->_getRepository()->find($artefato->getSqArtefato());
     $sqTipoVinculo = $this->_getRepository('app:TipoVinculoArtefato')->find(\Core_Configuration::getSgdoceTipoVinculoArtefatoApoio());
     $entity = new \Sgdoce\Model\Entity\ArtefatoVinculo();
     $entity->setSqArtefatoPai($sqArtefatoPai);
     $entity->setSqArtefatoFilho($sqArtefatoFilho);
     $entity->setSqTipoVinculoArtefato($sqTipoVinculo);
     $entity->setDtVinculo(\Zend_Date::now());
     $this->getEntityManager()->persist($entity);
     $this->getEntityManager()->flush();
     return $entity;
 }
Example #2
0
 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;
 }