class Database in Audit Log 8.2
Same name and namespace in other branches
- 8 src/StorageBackend/Database.php \Drupal\audit_log\StorageBackend\Database
Writes audit events to a custom database table.
@package Drupal\audit_log\StorageBackend
Hierarchy
- class \Drupal\audit_log\StorageBackend\Database implements StorageBackendInterface
Expanded class hierarchy of Database
1 string reference to 'Database'
1 service uses Database
File
- src/
StorageBackend/ Database.php, line 13
Namespace
Drupal\audit_log\StorageBackendView source
class Database implements StorageBackendInterface {
/**
* {@inheritdoc}
*/
public function save(AuditLogEventInterface $event) {
$values = [
'entity_id' => $event
->getEntity()
->id(),
'entity_type' => $event
->getEntity()
->getEntityTypeId(),
'event' => $event
->getEventType(),
'previous_state' => $event
->getPreviousState(),
'current_state' => $event
->getCurrentState(),
'message' => $event
->getMessage(),
];
\Drupal::moduleHandler()
->alter('audit_log_save', $values, $event);
AuditLog::create($values)
->save();
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Database:: |
public | function |
Writes the event to the storage backend's storage system. Overrides StorageBackendInterface:: |