本文整理汇总了PHP中UserModel::setId方法的典型用法代码示例。如果您正苦于以下问题:PHP UserModel::setId方法的具体用法?PHP UserModel::setId怎么用?PHP UserModel::setId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserModel
的用法示例。
在下文中一共展示了UserModel::setId方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadBy
/**
* Load user by a particular field
* @param string $field The field to find by
* @param string $value The field value
* @return UserModel
*/
public static function loadBy($field, $value)
{
global $wpdb;
$UserModel = new UserModel();
switch ($field) {
case 'id':
$memberData = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->prefix}{$UserModel->_tableName} WHERE user_id = %d AND status != 'deleted'", $value), ARRAY_A);
break;
case 'verification_code':
$memberData = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->prefix}{$UserModel->_tableName} WHERE verification_code = %s AND status != 'deleted'", $value), ARRAY_A);
break;
case 'reset_password_code':
$memberData = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->prefix}{$UserModel->_tableName} WHERE reset_password_code = %s AND status != 'deleted'", $value), ARRAY_A);
break;
case 'email_address':
$memberData = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->prefix}{$UserModel->_tableName} WHERE email_address = %s AND status != 'deleted'", $value), ARRAY_A);
break;
}
if ($memberData) {
$UserModel->setId($memberData['user_id']);
$UserModel->populateFromArray($memberData);
if ($UserModel->getStatus() == 'deleted') {
return new UserModel();
}
}
return $UserModel;
}
示例2: findById
public function findById($id)
{
$data = $this->storage->findById($id);
$user = new UserModel();
$user->setId($data['id']);
$user->setName($data['name']);
$user->setEmail($data['email']);
$user->setActive($data['active']);
return $user;
}
示例3: fromObject
public static function fromObject($o)
{
$user = new UserModel();
$user->setId($o->id);
$user->setEmail($o->email);
$user->setPassword($o->password);
$user->setName($o->name);
$user->setSurname($o->surname);
$user->setOrganisation($o->organisation);
return $user;
}
示例4: getSome
/**
* @param string $whereClause
* @see ControllerBase::getSome()
*/
public function getSome($whereClause = '1 = 1')
{
$sql = <<<SQL
SELECT id
, username
, password
, psalt
, created
, updated
FROM user
WHERE {$whereClause}
ORDER
BY updated
SQL;
$stmt = $this->_dbh->prepare($sql);
if (!$stmt) {
throw new ControllerException('Failed to prepare SELECT statement. (' . $this->_dbh->error . ') from this SQL: ' . $sql);
}
if (!$stmt->execute()) {
throw new ControllerException('Failed to execute SELECT statement. (' . $this->_dbh->error . ')');
}
$id = $userName = $password = $psalt = $created = $updated = null;
$stmt->bind_result($id, $userName, $password, $psalt, $created, $updated);
$models = array();
while ($stmt->fetch()) {
$model = new UserModel();
$model->setId($id);
$model->setUserName($userName);
$model->setPassword($password);
$model->setPSalt($psalt);
$model->setCreated($created);
$model->setUpdated($updated);
$models[] = $model;
}
return $models;
}
示例5: function
$app->get('/general/statistics', function () {
$cra = new CesRestAPI();
print $cra->getStatistics();
})->setName('general statistics');
// logout
$app->get('/general/backup', function () {
$cra = new CesRestAPI();
print $cra->saveBackup();
})->setName('general backup');
//user post (update)
$app->post('/user/:id', function ($id) use($app) {
$body = $app->request()->getBody();
parse_str($body, $data);
//die(var_dump($data));
$user = new UserModel();
$user->setId($id);
$user->setCesUid($data['ces_uid']);
$user->setPassword($data['password']);
$user->setFirstname($data['firstname']);
$user->setSurname($data['surname']);
$user->setOrgname($data['orgname']);
$user->setAddress1($data['address1']);
$user->setAddress2($data['address2']);
$user->setAddress3($data['address3']);
$user->setPostcode($data['postcode']);
$user->setSubareaId($data['subareaId']);
$user->setSubarea($data['subarea']);
$user->setPhoneh($data['phoneh']);
$user->setPhonew($data['phonew']);
$user->setPhonef($data['phonef']);
$user->setPhonem($data['phonem']);