当前位置: 首页>>代码示例>>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;未经允许,请勿转载。