chg: [auditLog] Fetch field required for model info

pull/7975/head
Jakub Onderka 2021-11-22 15:28:48 +01:00
parent 328b326297
commit 9458290b92
1 changed files with 5 additions and 0 deletions

View File

@ -94,6 +94,11 @@ class AuditLogBehavior extends ModelBehavior
$fieldToFetch[] = 'event_id';
}
// Fetch fields that are necessary to fill object title
if (isset($this->modelInfo[$model->name]) && is_string($this->modelInfo[$model->name]) && !in_array($this->modelInfo[$model->name], $fieldToFetch, true)) {
$fieldToFetch[] = $this->modelInfo[$model->name];
}
if (empty($fieldToFetch)) {
$this->old = null;
return true;