public function saveDocumento(\Core_Dto_Abstract $dto) { \Zend_Registry::get('doctrine')->getEntityManager()->clear(); $entityEndereco = $this->_getRepository()->findOneBy(array('sqEnderecoSgdoce' => $dto->getSqEnderecoSgdoce())); $result = !$entityEndereco ? $this->insertArquivo($dto) : $this->updateArquivo($dto, $entityEndereco); return array('entity' => $result, 'isUpdate' => !$entityEndereco ? false : true); }
public function updateEndereco(\Core_Dto_Abstract $dto, $params = null) { $return = null; try { $_qb = $this->_em->createQueryBuilder(); $_qb->update('app:EnderecoSgdoce', 'es')->set('es.sqTipoEndereco', $_qb->expr()->literal($dto->getSqTipoEndereco()))->set('es.sqMunicipio', $_qb->expr()->literal($dto->getSqMunicipio()))->set('es.coCep', $_qb->expr()->literal($dto->getCoCep()))->set('es.noBairro', $_qb->expr()->literal($dto->getNoBairro()))->set('es.txEndereco', $_qb->expr()->literal($dto->getTxEndereco()))->set('es.nuEndereco', $_qb->expr()->literal($dto->getNuEndereco()))->set('es.txComplemento', $_qb->expr()->literal($dto->getTxComplemento()))->set('es.noContato', $_qb->expr()->literal($params->getNoContato()))->where('es.sqEnderecoSgdoce = :sqEnderecoSgdoce')->setParameter('sqEnderecoSgdoce', $dto->getSqEnderecoSgdoce())->getQuery()->execute(); $return = true; } catch (Exception $e) { } return $return; }