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


PHP UserMapper::find方法代碼示例

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


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

示例1: testFindUser

 public function testFindUser()
 {
     $userName = "forFindUser";
     $user = getUserInstance($userName);
     $umapper = new UserMapper(self::$pdo);
     $umapper->insert($user);
     $newUser = $umapper->find($user->user_id);
     $this->assertEquals($userName, $newUser->user_name);
 }
開發者ID:shimizu9128,項目名稱:nfcCheckin,代碼行數:9,代碼來源:UserMapperTest.php

示例2: PostMapper

#include('DomainObjects.php');
$mapper = new PostMapper($db);
$post = new Post();
$post->title = 'New Title';
$post->content = 'New content...';
$post->author_id = 1;
//$mapper->insert($post);
$post->id = 2;
$mapper->update($post);
$post = $mapper->find(1);
$post->title = 'Updated Title';
$post->content = 'Updated content...';
$mapper->update($post);
$posts = $mapper->find();
$userMapper = new UserMapper($db);
$user = $userMapper->find(1);
p($user);
?>

<?php 
foreach ($posts as $post) {
    ?>
<h1><?php 
    echo $post->title;
    ?>
</h1>
<p><?php 
    echo $post->content;
    ?>
</p>
<?php 
開發者ID:TheProjecter,項目名稱:skeleton,代碼行數:31,代碼來源:example1.php

示例3: catch

<?php

require '../../../vendor/autoload.php';
require '../Resources/User/Mapper/User.php';
use Xeeo\Services\Database\Mongo\Mapper as MongoMapper, Xeeo\Services\Paginator\PaginatorApi, Xeeo\Services\Database\Mongo\Filter;
MongoMapper::addConnection(array('name' => 'connectionName', 'url' => 'mongodb://localhost:27017/databaseName'));
try {
    $users = UserMapper::find();
    /**
     * @var PaginatorApi $paginatorApi
     */
    $paginatorApi = PaginatorApi::getInstance();
    $paginatorApi->setCollection($users)->setItemsPerPage(3)->setCurrentPage(1)->setUrlPattern("http://www.example.com/page/{#PAGE}")->setHtmlTemplate('../Resources/Paginator/paginationTemplate.phtml');
    echo $paginatorApi->render();
} catch (\Exception $e) {
    print_r($e->getMessage());
}
開發者ID:xeeo,項目名稱:php-services,代碼行數:17,代碼來源:PaginatorExample.php

示例4: testInit

while (true) {
    sleep(5);
    $result = tagToolsParser(exec('python ' . htmlspecialchars($nfcpyPath)));
    if (!isset($result['IDm'])) {
        continue;
    }
    $dbfacade = DBFacade::I($pdo);
    $log = $dbfacade->checkin($result['IDm']);
    $idm = $imapper->find($log->idm_id);
    $idmArray = $idm->toArray();
    $postData = array();
    var_dump($idm);
    if ($idm != NULL) {
        $postData += array('cardName' => $idm->card_name);
        $postData += array('checkinNum' => $idm->checkin_num);
        $user = $umapper->find($idm->user_id);
        $postData += array('userName' => $user->user_name);
    }
    $postData += array('IDm' => $result['IDm']);
    $postData += array('checkinTime' => $log->checkin_time);
    $result = file_get_contents($domainName . "touch", false, stream_context_create(array('http' => array('method' => 'POST', 'header' => implode("\r\n", array('Content-Type: application/x-www-form-urlencoded')), 'content' => http_build_query(array('json' => json_encode((array) $postData)))))));
    // この行を実行すると貯金箱からの入金機能が利用できる
    // 挙動が恐ろしいほど安定していないかつ現狀では500円しか読み取れないので、デフォルトではコメントアウトしておく
    // exec("php observeMoneyBox.php &");
}
// DB clean up
function testInit()
{
    $pdo = getPDO('test');
    $pdo->beginTransaction();
    $pdo->query('DELETE FROM CheckinLogs');
開發者ID:shimizu9128,項目名稱:nfcCheckin,代碼行數:31,代碼來源:nfcCheckinMain.php

示例5: json_encode

<?php

$rootPass = dirname(__FILE__) . '/../../';
require_once $rootPass . 'lib/db/dbfunctions.php';
require_once $rootPass . 'lib/db/Model/User.php';
require_once $rootPass . 'lib/db/Mapper/UserMapper.php';
// $pdo = getPDO('test');
$pdo = getPDO($argv[2]);
$umapper = new UserMapper($pdo);
$user = $umapper->find((int) $argv[1]);
$result = array();
$result += array('userId' => $user->user_id);
$result += array('userName' => $user->user_name);
$result += array('mailAddress' => $user->mail_address);
$result += array('password' => $user->password);
$result += array('profile' => $user->profile);
$result += array('coin' => $user->coin);
header("Content-Type: application/json; charset=utf-8");
echo json_encode($result);
開發者ID:shimizu9128,項目名稱:nfcCheckin,代碼行數:19,代碼來源:getUser.php


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