Commit 51ddb2b3 authored by Tino Goratsch's avatar Tino Goratsch

fix a bug when saving the sharing info

parent ed0941a6
......@@ -20,7 +20,7 @@ class ShareModel extends AbstractModel
*/
public function save(array $data, $entryId = null)
{
$data = \array_merge($data, $this->getData($data));
$data = \array_merge($data, $this->mapDataFromRequest($data));
return parent::save($data, $entryId);
}
......@@ -30,9 +30,9 @@ class ShareModel extends AbstractModel
*
* @return array
*/
private function getData(array $data): array
private function mapDataFromRequest(array $data): array
{
$newData = [];
$mappedData = [];
$keys = [
'active' => 'share_active',
'services' => 'share_services',
......@@ -40,11 +40,15 @@ class ShareModel extends AbstractModel
];
foreach ($keys as $column => $formField) {
if (isset($data[$formField])) {
$newData[$column] = $data[$formField];
$mappedData[$column] = $data[$formField];
}
}
return $newData;
if (isset($data['share_customize_services']) && $data['share_customize_services'] == 0) {
$mappedData['services'] = [];
}
return $mappedData;
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment