chg: [log] Log when saving tags fails for attribute or event

pull/7830/head
Jakub Onderka 2021-10-12 09:25:15 +02:00
parent 60ac21e252
commit b5856d6f73
2 changed files with 10 additions and 2 deletions

View File

@ -3616,7 +3616,11 @@ class Attribute extends AppModel
$at['event_id'] = $eventId;
$toSave[] = $at;
}
$this->AttributeTag->saveMany($toSave, ['validate' => true]);
if (!$this->AttributeTag->saveMany($toSave, ['validate' => true])) {
$this->log("Could not save tags when capturing attribute with ID {$this->id}.", LOG_WARNING);
} else if (!empty($this->AttributeTag->validationErrors)) {
$this->log("Could not save some tags when capturing attribute with ID {$this->id}: " . json_encode($this->AttributeTag->validationErrors), LOG_WARNING);
}
}
if (isset($attribute['Tag'])) {
if (!empty($attribute['Tag']['name'])) {

View File

@ -3823,7 +3823,11 @@ class Event extends AppModel
$et['event_id'] = $this->id;
$toSave[] = $et;
}
$this->EventTag->saveMany($toSave, ['validate' => true]);
if (!$this->EventTag->saveMany($toSave, ['validate' => true])) {
$this->log("Could not save tags when capturing event with ID {$this->id}.", LOG_WARNING);
} else if (!empty($this->EventTag->validationErrors)) {
$this->log("Could not save some tags when capturing event with ID {$this->id}: " . json_encode($this->EventTag->validationErrors), LOG_WARNING);
}
}
$parentEvent = $this->find('first', array(
'conditions' => array('Event.id' => $this->id),