當前位置: 首頁>>代碼示例>>PHP>>正文


PHP sfGuardUserPeer::doCount方法代碼示例

本文整理匯總了PHP中sfGuardUserPeer::doCount方法的典型用法代碼示例。如果您正苦於以下問題:PHP sfGuardUserPeer::doCount方法的具體用法?PHP sfGuardUserPeer::doCount怎麽用?PHP sfGuardUserPeer::doCount使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在sfGuardUserPeer的用法示例。


在下文中一共展示了sfGuardUserPeer::doCount方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: executeSignin

 /**
  * This is a symfony workaround. As soon as someone logs in check if they are in the DB.
  * If they aren't just insert them so they can authenticate.
  *
  * @param sfWebRequest $request
  */
 public function executeSignin($request)
 {
     if ($request->isMethod("post")) {
         $form = new sfGuardFormSignin();
         $username = $request->getParameter($form->getName() . "[username]");
         $c = new Criteria();
         $c->add(sfGuardUserPeer::USERNAME, $username);
         $res = sfGuardUserPeer::doCount($c);
         // if they dont exist in the db then stick them in so LDAP works
         if ($res == 0) {
             $u = new sfGuardUser();
             $u->setUsername($username);
             $u->save();
             $u->getProfile();
         }
     }
     parent::executeSignin($request);
 }
開發者ID:adatta02,項目名稱:comp190-code,代碼行數:24,代碼來源:actions.class.php

示例2: countUsers

 public static function countUsers()
 {
     $cache = sfcontext::getInstance()->getViewCacheManager() ? sfcontext::getInstance()->getViewCacheManager()->getCache() : false;
     if ($cache) {
         $key = md5("users_counter");
         $data = unserialize($cache->get($key));
     } else {
         $data = false;
     }
     if (!$data) {
         //$user = sfContext::getInstance()->getUser();
         //$culture = $user->getCulture();
         $cuser = new Criteria();
         $cuser->add(sfGuardUserPeer::IS_ACTIVE, 1);
         $data = sfGuardUserPeer::doCount($cuser);
         if ($cache) {
             $cache->set($key, serialize($data), 360);
         }
     }
     return $data;
 }
開發者ID:voota,項目名稱:voota,代碼行數:21,代碼來源:SfVoCounter.class.php


注:本文中的sfGuardUserPeer::doCount方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。