mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-30 01:04:12 +02:00
DbObject: Fix the array to string conversion
This commit is contained in:
parent
3dfec6b8bd
commit
9bc8d3882e
@ -600,6 +600,11 @@ abstract class DbObject
|
|||||||
$this->beforeStore();
|
$this->beforeStore();
|
||||||
$table = $this->table;
|
$table = $this->table;
|
||||||
$id = $this->getId();
|
$id = $this->getId();
|
||||||
|
if (is_array($id)) {
|
||||||
|
$logId = json_encode($id);
|
||||||
|
} else {
|
||||||
|
$logId = $id;
|
||||||
|
}
|
||||||
$result = false;
|
$result = false;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -612,12 +617,12 @@ abstract class DbObject
|
|||||||
$this->onUpdate();
|
$this->onUpdate();
|
||||||
} else {
|
} else {
|
||||||
throw new Exception(
|
throw new Exception(
|
||||||
sprintf('FAILED storing %s "%s"', $table, $id));
|
sprintf('FAILED storing %s "%s"', $table, $logId));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ($id && $this->existsInDb()) {
|
if ($id && $this->existsInDb()) {
|
||||||
throw new Exception(
|
throw new Exception(
|
||||||
sprintf('Trying to recreate %s (%s)', $table, $id)
|
sprintf('Trying to recreate %s (%s)', $table, $logId)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -634,20 +639,17 @@ abstract class DbObject
|
|||||||
$result = true;
|
$result = true;
|
||||||
} else {
|
} else {
|
||||||
throw new Exception(
|
throw new Exception(
|
||||||
sprintf('FAILED to store new %s "%s"', $table, $id)
|
sprintf('FAILED to store new %s "%s"', $table, $logId)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
if (is_array($id)) {
|
|
||||||
$id = print_r($id, 1);
|
|
||||||
}
|
|
||||||
throw new Exception(
|
throw new Exception(
|
||||||
sprintf(
|
sprintf(
|
||||||
'Storing %s[%s] failed: %s {%s}',
|
'Storing %s[%s] failed: %s {%s}',
|
||||||
$this->table,
|
$this->table,
|
||||||
$id,
|
$logId,
|
||||||
$e->getMessage(),
|
$e->getMessage(),
|
||||||
print_r($this->getProperties(), 1)
|
print_r($this->getProperties(), 1)
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user