public function getListagem($arrData = array(), $intPage = 1, $intQtdPage = 10)
 {
     $queryBuilder = $this->_em->createQueryBuilder();
     $queryBuilder->select('PessoaFisica')->addSelect('Login.dsLogin')->from('Application\\Entity\\PessoaFisica', 'PessoaFisica')->innerJoin('Application\\Entity\\Login', 'Login', 'with', 'Login.idPessoaFisica = PessoaFisica.idPessoaFisica')->setMaxResults($intQtdPage)->setFirstResult($intPage * ($intPage - 1))->orderBy('PessoaFisica.dsNome', 'asc');
     # bind nome
     if ($arrData['dsNome']) {
         $queryBuilder->andWhere($queryBuilder->expr()->like('PessoaFisica.dsNome', ':dsNome'))->setParameter('dsNome', '%' . $arrData['dsNome'] . '%');
     }
     # bind cpf
     if ($arrData['dsCpf']) {
         $queryBuilder->andWhere('PessoaFisica.dsCpf = :dsCpf')->setParameter('dsCpf', Format::clearCpfCnpj($arrData['dsCpf']));
     }
     # bind dsEmail
     if ($arrData['dsEmail']) {
         $queryBuilder->andWhere('PessoaFisica.dsEmail = :dsEmail')->setParameter('dsEmail', $arrData['dsEmail']);
     }
     # bind dsLogin
     if ($arrData['dsLogin']) {
         $queryBuilder->andWhere('Login.dsLogin = :dsLogin')->setParameter('dsLogin', $arrData['dsLogin']);
     }
     $query = $queryBuilder->getQuery();
     $registerPaginator = new Paginator($query);
     $registerPaginator->setUseOutputWalkers(false);
     $intCountResult = $registerPaginator->count();
     $arrDadosPaginator = array('qtdRegister' => $intCountResult, 'qtdPages' => ceil($intCountResult / $intQtdPage), 'pageActual' => $intPage, 'maxResult' => $intQtdPage, 'register' => $registerPaginator);
     return $arrDadosPaginator;
 }
Ejemplo n.º 2
0
 public function pesquisar($strCEP)
 {
     $adapter = $this->getAdapter();
     $arrResult = $adapter->pesquisaCep(Format::clearMask($strCEP));
     if (!$arrResult['status']) {
         throw new \Exception($arrResult['message']);
     }
     $arrResult = $this->makeResult($arrResult);
     //        if (array_key_exists('idMunicipio', $arrResult)) {
     //            # operacao de cadastro
     //        }
     return $arrResult;
 }
Ejemplo n.º 3
0
 public function ajaxCheckInformationAction()
 {
     $request = $this->getRequest();
     $booValidate = false;
     if ($request->isPost()) {
         $arrData = $request->getPost()->toArray();
         if (array_key_exists('dsCpf', $arrData)) {
             $arrData['dsCpf'] = Format::clearCpfCnpj($arrData['dsCpf']);
         }
         $booValidate = $this->getService()->validateInformacao($arrData);
     }
     return new JsonModel(['status' => $booValidate]);
 }
Ejemplo n.º 4
0
 public function save($arrData)
 {
     try {
         if ($arrData['idEmpreendimento']) {
             $empreendimento = $this->find($arrData['idEmpreendimento']);
         } else {
             $empreendimento = new EmpreendimentoEntity();
         }
         $empreendimento->setCoCep(Format::clearMask($arrData['coCep']))->setDsBairro($arrData['dsBairro'])->setDsComplemento($arrData['dsComplemento'])->setDsEmpreendimento($arrData['dsEmpreendimento'])->setDsLogradouro($arrData['dsLogradouro'])->setIdMunicipio($this->getReferenceEntity($arrData['coMunicipio'], 'Application\\Entity\\Municipio'))->setInSituacao(EmpreendimentoEntity::co_situacao_ativo);
         $this->getEntityManager()->persist($empreendimento);
         $this->getEntityManager()->flush();
     } catch (\Exception $exception) {
         throw new \Exception($exception->getMessage());
     }
 }