本文整理汇总了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;
}