当前位置: 首页>>代码示例>>PHP>>正文


PHP Model_User::fetchAll方法代码示例

本文整理汇总了PHP中Model_User::fetchAll方法的典型用法代码示例。如果您正苦于以下问题:PHP Model_User::fetchAll方法的具体用法?PHP Model_User::fetchAll怎么用?PHP Model_User::fetchAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Model_User的用法示例。


在下文中一共展示了Model_User::fetchAll方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testShouldNotInsertDuplicateRecord

 public function testShouldNotInsertDuplicateRecord()
 {
     if (!$this->_testsEnabled) {
         return;
     }
     $userModel = new Model_User();
     $userId = $userModel->insert(array('email' => self::TEST_EMAIL));
     $pwless = new Garp_Auth_Adapter_Passwordless();
     $pwless->requestToken(array('email' => self::TEST_EMAIL));
     $users = $userModel->fetchAll();
     $this->assertEquals(1, count($users));
     $this->assertEquals($userId, $users[0]->id);
 }
开发者ID:grrr-amsterdam,项目名称:garp3,代码行数:13,代码来源:PasswordlessTest.php

示例2: SelectUser

 public function SelectUser($name, $value = null, $attribs = null, $currentUser = 0)
 {
     $u = new Model_User();
     $users = $u->fetchAll(null, 'first_name');
     $userArray[] = $this->view->getTranslation('Select User');
     if ($users->count() > 0) {
         foreach ($users as $user) {
             if ($user->id != $currentUser) {
                 $userArray[$user->id] = $user->first_name . ' ' . $user->last_name;
             }
         }
     }
     return $this->view->formSelect($name, $value, $attribs, $userArray);
 }
开发者ID:ngukho,项目名称:ducbui-cms,代码行数:14,代码来源:SelectUser.php

示例3: fetchAction

 public function fetchAction()
 {
     //定义查询方法
     $table = new Model_User();
     //类的实例化
     //定义查询条件
     $where = null;
     $order = "id desc";
     //以ID降序排列
     $count = 3;
     //输出3条记录
     $offset = 0;
     //从第1条记录开始
     $result_all = $table->fetchAll();
     //执行查询语句
     $this->view->select = $result_all;
 }
开发者ID:Arrray,项目名称:PHPpractice,代码行数:17,代码来源:IndexController.php

示例4: selectUser

 public function selectUser($name, $value = null, $attribs = null, $currentUser = 0)
 {
     $u = new Model_User();
     $users = $u->fetchAll(null, 'first_name');
     $options[] = $this->view->getTranslation('Select User');
     if ($users->count() > 0) {
         foreach ($users as $user) {
             if ($user->name != $currentUser) {
                 $options[$user->name] = $user->first_name . ' ' . $user->last_name;
             }
         }
     }
     $form = new Digitalus_Form();
     $select = $form->createElement('select', $name, array('multiOptions' => $options));
     if (is_array($value)) {
         $select->setValue($value);
     }
     if (is_array($attribs)) {
         $select->setAttribs($attribs);
     }
     return $select;
 }
开发者ID:laiello,项目名称:digitalus-cms,代码行数:22,代码来源:SelectUser.php

示例5: mapFriends

 /**
  * Find friends of logged in user and map to local friends table.
  * @param Array $config
  * @return Bool Success
  */
 public function mapFriends(array $config)
 {
     $config = $config instanceof Garp_Util_Configuration ? $config : new Garp_Util_Configuration($config);
     $config->obligate('bindingModel')->obligate('user_id')->setDefault('accessToken', $this->getAccessToken());
     if (!$config['accessToken']) {
         // Find the auth record
         $authModel = new Model_AuthFacebook();
         $authRow = $authModel->fetchRow($authModel->select()->where('user_id = ?', $config['user_id']));
         if (!$authRow || !$authRow->access_token) {
             return false;
         }
         // Use the stored access token to create a user session. Me() in the FQL ahead will contain the user's Facebook ID.
         // Note that the access token is available for a very limited time. Chances are it's not valid anymore.
         $accessToken = $authRow->access_token;
     }
     try {
         $this->_client->setAccessToken($config['accessToken']);
         // Find the friends' Facebook UIDs
         $friends = $this->_client->api(array('method' => 'fql.query', 'query' => 'SELECT uid2 FROM friend WHERE uid1 = me()'));
         // Find local user records
         $userModel = new Model_User();
         $userTable = $userModel->getName();
         $authFbModel = new Model_AuthFacebook();
         $authFbTable = $authFbModel->getName();
         $fbIds = '';
         $friendCount = count($friends);
         foreach ($friends as $i => $friend) {
             $fbIds .= $userModel->getAdapter()->quote($friend['uid2']);
             if ($i < $friendCount - 1) {
                 $fbIds .= ',';
             }
         }
         $friendQuery = $userModel->select()->setIntegrityCheck(false)->from($userTable, array('id'))->join($authFbTable, $authFbTable . '.user_id = ' . $userTable . '.id', array())->where('facebook_uid IN (' . $fbIds . ')')->order($userTable . '.id');
         $localUsers = $userModel->fetchAll($friendQuery);
         $localUserCount = count($localUsers);
         // Insert new friendships into binding model
         $bindingModel = new $config['bindingModel']();
         $insertSql = 'INSERT IGNORE INTO ' . $bindingModel->getName() . ' (user1_id, user2_id) VALUES ';
         foreach ($localUsers as $i => $localUser) {
             $insertSql .= '(' . $localUser->id . ',' . $config['user_id'] . '),';
             $insertSql .= '(' . $config['user_id'] . ',' . $localUser->id . ')';
             if ($i < $localUserCount - 1) {
                 $insertSql .= ',';
             }
         }
         $result = $bindingModel->getAdapter()->query($insertSql);
         // Clear cache manually, since the table isn't updated thru conventional paths.
         Garp_Cache_Manager::purge($bindingModel);
         return !!$result;
     } catch (Exception $e) {
         return false;
     }
 }
开发者ID:grrr-amsterdam,项目名称:garp3,代码行数:58,代码来源:Facebook.php


注:本文中的Model_User::fetchAll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。