本文整理匯總了PHP中Fave::insert方法的典型用法代碼示例。如果您正苦於以下問題:PHP Fave::insert方法的具體用法?PHP Fave::insert怎麽用?PHP Fave::insert使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Fave
的用法示例。
在下文中一共展示了Fave::insert方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: addNew
static function addNew($user, $notice)
{
$fave = new Fave();
$fave->user_id = $user->id;
$fave->notice_id = $notice->id;
if (!$fave->insert()) {
common_log_db_error($fave, 'INSERT', __FILE__);
return false;
}
return $fave;
}
示例2: addNew
/**
* Save a favorite record.
* @fixme post-author notification should be moved here
*
* @param Profile $profile the local or remote user who likes
* @param Notice $notice the notice that is liked
* @return mixed false on failure, or Fave record on success
*/
static function addNew(Profile $profile, Notice $notice)
{
$fave = null;
if (Event::handle('StartFavorNotice', array($profile, $notice, &$fave))) {
$fave = new Fave();
$fave->user_id = $profile->id;
$fave->notice_id = $notice->id;
if (!$fave->insert()) {
common_log_db_error($fave, 'INSERT', __FILE__);
return false;
}
Event::handle('EndFavorNotice', array($profile, $notice));
}
return $fave;
}
示例3: addNew
/**
* Save a favorite record.
* @fixme post-author notification should be moved here
*
* @param Profile $profile the local or remote user who likes
* @param Notice $notice the notice that is liked
* @return mixed false on failure, or Fave record on success
*/
static function addNew(Profile $profile, Notice $notice)
{
$fave = null;
if (Event::handle('StartFavorNotice', array($profile, $notice, &$fave))) {
$fave = new Fave();
$fave->user_id = $profile->id;
$fave->notice_id = $notice->id;
$fave->modified = common_sql_now();
$fave->uri = self::newURI($fave->user_id, $fave->notice_id, $fave->modified);
if (!$fave->insert()) {
common_log_db_error($fave, 'INSERT', __FILE__);
return false;
}
self::blow('fave:list-ids:notice_id:%d', $fave->notice_id);
self::blow('popular');
Event::handle('EndFavorNotice', array($profile, $notice));
}
return $fave;
}