Ejemplo n.º 1
0
 function addToGroupInbox(User_group $group)
 {
     $gi = Group_inbox::pkeyGet(array('group_id' => $group->id, 'notice_id' => $this->id));
     if (!$gi instanceof Group_inbox) {
         $gi = new Group_inbox();
         $gi->group_id = $group->id;
         $gi->notice_id = $this->id;
         $gi->created = $this->created;
         $result = $gi->insert();
         if (!$result) {
             common_log_db_error($gi, 'INSERT', __FILE__);
             // TRANS: Server exception thrown when an update for a group inbox fails.
             throw new ServerException(_('Problem saving group inbox.'));
         }
         self::blow('user_group:notice_ids:%d', $gi->group_id);
     }
     return true;
 }
Ejemplo n.º 2
0
 function addToGroupInbox($group)
 {
     $gi = Group_inbox::pkeyGet(array('group_id' => $group->id, 'notice_id' => $this->id));
     if (empty($gi)) {
         $gi = new Group_inbox();
         $gi->group_id = $group->id;
         $gi->notice_id = $this->id;
         $gi->created = $this->created;
         $result = $gi->insert();
         if (!$result) {
             common_log_db_error($gi, 'INSERT', __FILE__);
             throw new ServerException(_('Problem saving group inbox.'));
         }
         self::blow('user_group:notice_ids:%d', $gi->group_id);
     }
     return true;
 }