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