Skip to content
Snippets Groups Projects
Verified Commit 4cd79e5c authored by Damien's avatar Damien
Browse files

FEAT #8969 Do not save picture if empty

parent 24cf7462
No related branches found
No related tags found
No related merge requests found
...@@ -103,13 +103,16 @@ class UserModel ...@@ -103,13 +103,16 @@ class UserModel
ValidatorModel::intVal($aArgs, ['id']); ValidatorModel::intVal($aArgs, ['id']);
ValidatorModel::stringType($aArgs, ['firstname', 'lastname', 'picture']); ValidatorModel::stringType($aArgs, ['firstname', 'lastname', 'picture']);
$set = [
'firstname' => $aArgs['firstname'],
'lastname' => $aArgs['lastname']
];
if (!empty($aArgs['picture'])) {
$set['picture'] = $aArgs['picture'];
}
DatabaseModel::update([ DatabaseModel::update([
'table' => 'users', 'table' => 'users',
'set' => [ 'set' => $set,
'firstname' => $aArgs['firstname'],
'lastname' => $aArgs['lastname'],
'picture' => empty($aArgs['picture']) ? null : $aArgs['picture']
],
'where' => ['id = ?'], 'where' => ['id = ?'],
'data' => [$aArgs['id']] 'data' => [$aArgs['id']]
]); ]);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment