Some more protection against database errors
This commit is contained in:
parent
15d975f143
commit
dd8279afc2
1 changed files with 2 additions and 0 deletions
|
@ -160,6 +160,7 @@ class Contact
|
|||
$fields['created'] = DateTimeFormat::utcNow();
|
||||
}
|
||||
|
||||
$fields = DI::dbaDefinition()->truncateFieldsForTable('contact', $fields);
|
||||
DBA::insert('contact', $fields, $duplicate_mode);
|
||||
$contact = DBA::selectFirst('contact', [], ['id' => DBA::lastInsertId()]);
|
||||
if (!DBA::isResult($contact)) {
|
||||
|
@ -191,6 +192,7 @@ class Contact
|
|||
*/
|
||||
public static function update(array $fields, array $condition, $old_fields = [])
|
||||
{
|
||||
$fields = DI::dbaDefinition()->truncateFieldsForTable('contact', $fields);
|
||||
$ret = DBA::update('contact', $fields, $condition, $old_fields);
|
||||
|
||||
// Apply changes to the "user-contact" table on dedicated fields
|
||||
|
|
Loading…
Reference in a new issue