You are here

public function QueryActivity::insertActivity in Activity 8

Insert into activity.

Parameters

string $eventId: The action name.

string $entityType: The entity type.

string $nid: The node id.

string $uid: The user id.

string $status: The action status.

string $message: The message that keeps options from configure activity page.

1 call to QueryActivity::insertActivity()
QueryActivity::logActivity in src/QueryActivity.php
Log actions in table activity.

File

src/QueryActivity.php, line 111

Class

QueryActivity
Provides queries for activity.

Namespace

Drupal\activity

Code

public function insertActivity($eventId, $entityType, $nid, $uid, $status, $message) {
  $window = $this
    ->validActivity($eventId);

  // Insert only if the current timestamp - activity Window is greater than 0.
  if ($window) {
    $this->database
      ->insert('activity')
      ->fields([
      'event_id' => $eventId,
      'entity_type' => $entityType,
      'nid' => $nid,
      'uid' => $uid,
      'created' => \Drupal::time()
        ->getCurrentTime(),
      'status' => $status,
      'message' => $message,
    ])
      ->execute();
  }
}