CodeIgniter Forums
useSoftDeletes and insert - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: useSoftDeletes and insert (/showthread.php?tid=77682)



useSoftDeletes and insert - the_steff - 10-04-2020

Hi !

I write this part of code in order to return time data (created_at field) to the client when he wants to insert a new message in the db :


PHP Code:
(...)
$insertId $message_model->insert($data);
$message $message_model->find($insertId);
$message $message_model->normalize_dates($message);
(...) 

It's working fine.... except when I set "useSoftDeletes = true" into my "message_model" file. If I do that, find() method return "null" whereas $insertId seems to be correct.

Is that normal ?
Thanks !


RE: useSoftDeletes and insert - nc03061981 - 10-04-2020

Only use useSoftDeletes when you delete, you insert so do not need to set it or set it false if before setted


RE: useSoftDeletes and insert - the_steff - 10-05-2020

useSoftDeletes shouldn't be protected ?
I can define a special function in the model but it's a nonsense (?)

Actually, I think there few solutions possible to solve my "problem" but isn't it a bug to be corrected ?