本文整理匯總了PHP中UUID::getBin方法的典型用法代碼示例。如果您正苦於以下問題:PHP UUID::getBin方法的具體用法?PHP UUID::getBin怎麽用?PHP UUID::getBin使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類UUID
的用法示例。
在下文中一共展示了UUID::getBin方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: setUserAttitude
public function setUserAttitude(\User $user, $att)
{
self::checkIfCanVote($user);
$dbw = wfGetDB(DB_MASTER);
// Get current attitude
$oldatt = $this->getUserAttitude($user);
// Short path, return if they match
if ($oldatt === $att) {
return;
}
// Delete entry if the attitude is neutral
if ($att === static::ATTITUDE_NORMAL) {
$dbw->delete('FlowThreadAttitude', array('flowthread_att_id' => $this->id->getBin(), 'flowthread_att_userid' => $user->getId()));
} else {
if ($oldatt !== static::ATTITUDE_NORMAL) {
$dbw->update('FlowThreadAttitude', array('flowthread_att_type' => $att), array('flowthread_att_id' => $this->id->getBin(), 'flowthread_att_userid' => $user->getId()));
} else {
$dbw->insert('FlowThreadAttitude', array('flowthread_att_id' => $this->id->getBin(), 'flowthread_att_type' => $att, 'flowthread_att_userid' => $user->getId()));
}
}
// Update number in the main table
if ($oldatt === static::ATTITUDE_LIKE) {
$this->favorCount--;
} else {
if ($oldatt === static::ATTITUDE_REPORT) {
$this->reportCount--;
}
}
if ($att === static::ATTITUDE_LIKE) {
$this->favorCount++;
} else {
if ($att === static::ATTITUDE_REPORT) {
$this->reportCount++;
}
}
$this->updateFavorReportCount();
}