![]() |
Model Find function Changed? - 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: Model Find function Changed? (/showthread.php?tid=92822) |
Model Find function Changed? - dulongc - 04-29-2025 In the past when I used the find() function on a model while passing the primary key, I would get a single result as the documentation states. It seems now in v. 4.6.0 it acts like it is going to return multiple results. This requires me to call $returnedArray[0]['name'] instead of just $returnedArray[0]['name'] My Relevant Code: PHP Code: $transID = $this->request->getPost('trans_id',FILTER_SANITIZE_NUMBER_INT); This results in error: Quote:message 'Undefined array key "status"' Upon inspecting the return from the database I can see the issue is that it's returning the row within a multidimensional array. Expected Return: Code: $transModel = [ Actual Return Code: $transModel = [ I can do a work around by just overwriting the response. But am I wrong in believing this should already be the default response. PHP Code: $transID = $this->request->getPost('trans_id',FILTER_SANITIZE_NUMBER_INT); RE: Model Find function Changed? - dulongc - 04-29-2025 Never mind...... I made a dumb mistake ....... Disregard |