コード例 #1
0
 public function recoverPass(\Core_Dto_Abstract $dto)
 {
     $queryBuilder = $this->_em->createQueryBuilder();
     $query = $this->_em->createQueryBuilder()->select('u.sqUsuarioExterno, u.stRegistroAtivo' . ',u.txEmail, u.txSenha, u.noUsuarioExterno, u.stRegistroAtivo')->from('app:UsuarioExternoPerfil', 'up')->innerJoin('up.sqPerfil', 'per')->innerJoin('up.sqUsuarioExterno', 'u')->where($queryBuilder->expr()->eq('u.txEmail', ':txEmail'))->setParameter('txEmail', $dto->getTxEmail())->andWhere($queryBuilder->expr()->eq('per.inPerfilExterno', ':inPerfilExterno'))->setParameter(':inPerfilExterno', 'TRUE');
     $param = \Zend_Filter::filterStatic($dto->getTxLogin(), 'digits');
     $pessoa = 'sqUsuarioPessoaFisica';
     switch ($dto->getTpValidacao()) {
         case 'passaporte':
             $field = 'nuPassaporte';
             break;
         case 'cpf':
             $field = 'nuCpf';
             break;
         default:
             $pessoa = 'sqUsuarioPessoaJuridica';
             $field = 'nuCnpj';
             break;
     }
     $query->innerJoin("u.{$pessoa}", 'upfj')->andWhere($queryBuilder->expr()->eq("upfj.{$field}", ':param'))->setParameter('param', $param);
     $result = $query->getQuery()->getResult();
     return $result ? $result[0] : $result;
 }