Fixes for base repo

This commit is contained in:
David Bomba 2023-02-22 18:07:00 +11:00
parent 2fe47f572a
commit 392a4e5ccb

View File

@ -146,8 +146,9 @@ class BaseRepository
* @throws \ReflectionException * @throws \ReflectionException
*/ */
protected function alternativeSave($data, $model) protected function alternativeSave($data, $model)
{ { //$start = microtime(true);
if (array_key_exists('client_id', $data) && !empty($data['client_id'])) { //forces the client_id if it doesn't exist
if (array_key_exists('client_id', $data)) {
$model->client_id = $data['client_id']; $model->client_id = $data['client_id'];
} }
@ -176,6 +177,7 @@ class BaseRepository
if (isset($tmp_data['client_contacts'])) { if (isset($tmp_data['client_contacts'])) {
unset($tmp_data['client_contacts']); unset($tmp_data['client_contacts']);
}
$model->fill($tmp_data); $model->fill($tmp_data);
@ -195,7 +197,7 @@ class BaseRepository
}); });
} }
} }
}
$model->saveQuietly(); $model->saveQuietly();
/* Model now persisted, now lets do some child tasks */ /* Model now persisted, now lets do some child tasks */