A check if model has anything to update |
After one of CodeIgniter updates I started getting CodeIgniter\Database\Exceptions\DataException ("There is no data to update."). That is caused by the commit b5b6ddfa3fb8 ("Add additional empty checks after field protection.").
My problem is that \CodeIgniter\Entity::hasChanged() doesn't take into account model's $allowedFields. It means that if:
then hasChanged() will return true BUT BaseModel will throw "There is no data to update." Could we have some way of checking if BaseModel: ![]() Example: Code: <?php Code: <?php Code: $fooModel = new \App\Models\FooModel(); Current result: Code: array(2) { Code: CodeIgniter\Database\Exceptions\DataException |
Messages In This Thread |
A check if model has anything to update - by rmilecki - 04-17-2022, 02:20 PM
RE: A check if model has anything to update - by kenjis - 04-17-2022, 06:09 PM
RE: A check if model has anything to update - by rmilecki - 04-17-2022, 09:37 PM
RE: A check if model has anything to update - by kenjis - 04-17-2022, 11:12 PM
RE: A check if model has anything to update - by rmilecki - 04-17-2022, 11:15 PM
RE: A check if model has anything to update - by kenjis - 04-17-2022, 11:46 PM
RE: A check if model has anything to update - by rmilecki - 04-18-2022, 02:06 AM
RE: A check if model has anything to update - by kenjis - 04-18-2022, 04:31 PM
RE: A check if model has anything to update - by rmilecki - 04-19-2022, 02:45 AM
RE: A check if model has anything to update - by kenjis - 04-19-2022, 03:29 AM
RE: A check if model has anything to update - by rmilecki - 04-19-2022, 04:38 AM
|