protected function ActivityNotifications::changeStatusOfActivity in Open Social 8.9
Same name and namespace in other branches
- 8 modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::changeStatusOfActivity()
- 8.2 modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::changeStatusOfActivity()
- 8.3 modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::changeStatusOfActivity()
- 8.4 modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::changeStatusOfActivity()
- 8.5 modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::changeStatusOfActivity()
- 8.6 modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::changeStatusOfActivity()
- 8.7 modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::changeStatusOfActivity()
- 8.8 modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::changeStatusOfActivity()
- 10.3.x modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::changeStatusOfActivity()
- 10.0.x modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::changeStatusOfActivity()
- 10.1.x modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::changeStatusOfActivity()
- 10.2.x modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::changeStatusOfActivity()
Change the status of an activity.
Parameters
array $ids: Array of Activity entity IDs.
\Drupal\Core\Session\AccountInterface $account: Account object.
int $status: See: activity_creator_field_activity_status_allowed_values()
Return value
bool Status of update query.
2 calls to ActivityNotifications::changeStatusOfActivity()
- ActivityNotifications::markAllNotificationsAsSeen in modules/
custom/ activity_creator/ src/ ActivityNotifications.php - Mark all notifications as Seen for account.
- ActivityNotifications::markEntityAsRead in modules/
custom/ activity_creator/ src/ ActivityNotifications.php - Mark an entity as read for a given account.
File
- modules/
custom/ activity_creator/ src/ ActivityNotifications.php, line 187
Class
- ActivityNotifications
- Class ActivityNotifications to get Personalised activity items for account.
Namespace
Drupal\activity_creatorCode
protected function changeStatusOfActivity(array $ids, AccountInterface $account, $status = ACTIVITY_STATUS_RECEIVED) : bool {
if (!empty($ids)) {
// The transaction opens here.
$txn = $this->database
->startTransaction();
try {
// Collect the information about affected rows.
$this->database
->update('activity_notification_status')
->fields([
'status' => $status,
])
->condition('uid', $account
->id())
->condition('aid', $ids, 'IN')
->execute();
return TRUE;
} catch (\Exception $exception) {
// Something went wrong somewhere, so roll back now.
$txn
->rollBack();
// Log the exception to watchdog.
$this
->getLogger('default')
->error($exception
->getMessage());
}
}
return FALSE;
}