本文整理匯總了PHP中UserDao::findById方法的典型用法代碼示例。如果您正苦於以下問題:PHP UserDao::findById方法的具體用法?PHP UserDao::findById怎麽用?PHP UserDao::findById使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類UserDao
的用法示例。
在下文中一共展示了UserDao::findById方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getUserGetId
public static function getUserGetId()
{
$id = null;
try {
$id = self::getUrlParam('id');
} catch (Exception $ex) {
throw new NotFoundException('No user identifier provided.');
}
if (!is_numeric($id)) {
throw new NotFoundException('Invalid user identifier provided.');
}
$dao = new UserDao();
$user = $dao->findById($id);
if ($user === null) {
throw new NotFoundException('Unknown user identifier provided.');
}
return $user;
}
示例2: User
<?php
$user_id = $_POST['user']['id'];
$user_obj = null;
$updatedUser_obj = null;
$user_obj = new User();
$updatedUser_obj = new User();
if (array_key_exists('find', $_POST)) {
$data = array('id' => $_POST['user']['id']);
UserMapper::map($user_obj, $data);
$dao = new UserDao();
$foundUser = $dao->findById($user_id);
}
if (array_key_exists('update', $_POST)) {
$data = array('id' => $_POST['user']['id'], 'first_name' => $_POST['user']['first_name'], 'user_password' => $_POST['user']['user_password']);
UserMapper::map($updatedUser_obj, $data);
$dao = new UserDao();
$dao->update($updatedUser_obj);
Flash::addFlash('user record(s) updated successfully :)');
}