chg: [audit log naming] renamed action to request_action to avoid reserved keyword usage

pull/92/head
iglocska 2021-11-17 15:57:34 +01:00
parent 7b52d29320
commit fe8e217d61
No known key found for this signature in database
GPG Key ID: BEA224F1FEF113AC
2 changed files with 5 additions and 5 deletions

View File

@ -106,7 +106,7 @@ class AuditLogBehavior extends Behavior
$modelTitle = $this->old[$modelTitleField];
}
$this->auditLogs()->insert([
'action' => $action,
'request_action' => $action,
'model' => $entity->getSource(),
'model_id' => $id,
'model_title' => $modelTitle,
@ -130,7 +130,7 @@ class AuditLogBehavior extends Behavior
}
$logEntity = $this->auditLogs()->newEntity([
'action' => $entity->getConstant('ACTION_DELETE'),
'request_action' => $entity->getConstant('ACTION_DELETE'),
'model' => $entity->getSource(),
'model_id' => $this->old->id,
'model_title' => $modelTitle,

View File

@ -47,9 +47,9 @@ class AuditLog extends AppModel
*/
public function generateUserFriendlyTitle($auditLog)
{
if (in_array($auditLog['action'], [self::ACTION_TAG, self::ACTION_TAG_LOCAL, self::ACTION_REMOVE_TAG, self::ACTION_REMOVE_TAG_LOCAL], true)) {
$attached = ($auditLog['action'] === self::ACTION_TAG || $auditLog['action'] === self::ACTION_TAG_LOCAL);
$local = ($auditLog['action'] === self::ACTION_TAG_LOCAL || $auditLog['action'] === self::ACTION_REMOVE_TAG_LOCAL) ? __('local') : __('global');
if (in_array($auditLog['request_action'], [self::ACTION_TAG, self::ACTION_TAG_LOCAL, self::ACTION_REMOVE_TAG, self::ACTION_REMOVE_TAG_LOCAL], true)) {
$attached = ($auditLog['request_action'] === self::ACTION_TAG || $auditLog['request_action'] === self::ACTION_TAG_LOCAL);
$local = ($auditLog['request_action'] === self::ACTION_TAG_LOCAL || $auditLog['request_action'] === self::ACTION_REMOVE_TAG_LOCAL) ? __('local') : __('global');
if ($attached) {
return __('Attached %s tag "%s" to %s #%s', $local, $auditLog['model_title'], strtolower($auditLog['model']), $auditLog['model_id']);
} else {