public function deleteProfile(\Core_Dto_Mapping $mapping) { $criteria = array('sqUsuarioExterno' => $mapping->getUsuario(), 'sqPerfil' => $mapping->getPerfil()); $perfis = $this->_getRepository('app:UsuarioExternoPerfil')->findBy($criteria); foreach ($perfis as $perfil) { $this->getEntityManager()->remove($perfil); $this->getEntityManager()->flush(); } if (!$this->getServiceLocator()->getService('UsuarioExternoPerfil')->findBy(array('sqUsuarioExterno' => $mapping->getUsuario()))) { $entity = $this->find($mapping->getUsuario()); $entity->setStRegistroAtivo(\Core_Configuration::getSicaeUsuarioExtStRegistroInativo()); $this->getEntityManager()->persist($entity); $this->getEntityManager()->flush($entity); } }
public function deleteProfile(\Core_Dto_Mapping $mapping) { $criteria = array('sqUsuario' => $mapping->getUsuario(), 'sqUnidadeOrgPessoa' => $mapping->getUnidade(), 'sqPerfil' => $mapping->getPerfil()); $perfis = $this->_getRepository('app:UsuarioPerfil')->findBy($criteria); foreach ($perfis as $perfil) { $this->getEntityManager()->remove($perfil); $this->getEntityManager()->flush(); } if (!$this->getServiceLocator()->getService('UsuarioPerfil')->findBy(array('sqUsuario' => $mapping->getUsuario()))) { $entity = $this->find($mapping->getUsuario()); $this->getEntityManager()->persist($entity); $this->getEntityManager()->flush($entity); } }