You are here

function role_watchdog_save_entity in Role Watchdog 8

Helper function to save entity.

Parameters

$name:

$uid:

$action:

$user_performed_on:

array $rid:

Throws

\Drupal\Core\Entity\EntityStorageException

2 calls to role_watchdog_save_entity()
role_watchdog_user_insert in ./role_watchdog.module
Implements hook_ENTITY_TYPE_insert().
role_watchdog_user_update in ./role_watchdog.module
Implements hook_ENTITY_TYPE_update().

File

./role_watchdog.module, line 79
Contains role_watchdog.module.

Code

function role_watchdog_save_entity($name, $uid, $action, $user_performed_on, array $rid) {
  $entity = RoleWatchdog::create([
    'type' => 'role_grants',
    'name' => $name,
    'uid' => $uid,
    'action' => $action,
    'field_user_performed_on' => $user_performed_on,
    'field_role_id' => $rid,
  ]);
  $entity
    ->save();
}