public function saveDocumento(\Core_Dto_Abstract $dto) { \Zend_Registry::get('doctrine')->getEntityManager()->clear(); $entityAnexo = $this->_getRepository()->findOneBy(array('sqPessoaSgdoce' => $dto->getSqPessoaSgdoce(), 'sqTipoDocumento' => $dto->getSqTipoDocumento())); $result = $entityAnexo ? $this->updateArquivo($entityAnexo, $dto) : $this->insertArquivo($dto); return $entityAnexo ? 'update' : 'insert'; }