Problem with Model()->find() and Model()->findAll() - 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: Problem with Model()->find() and Model()->findAll() (/showthread.php?tid=74539) Pages:
1
2
|
RE: Problem with Model()->find() and Model()->findAll() - RobT - 10-30-2019 (10-06-2019, 12:03 PM)workoverflow Wrote: Hi! I have faced with problem with Model()->find() and Model()->findAll(). If i call ones of this methods i get null. It's doesn't work after update to 4.0.0-rc.2.1 with composer. Hi guys, I have the same problem. I'm using CI v4.0.0-rc.3 and couldn't get results using find() and findAll() methods. Just two simple files. Product model: PHP Code: <?php namespace App\Models; Catalog controller: PHP Code: <?php namespace App\Controllers; Could you help me in fixing it? Thanks for your support. RE: Problem with Model()->find() and Model()->findAll() - RobT - 10-31-2019 Fixed it, sorry. RE: Problem with Model()->find() and Model()->findAll() - Cassola - 03-24-2020 <?php namespace App\Models; use CodeIgniter\Model; class TestModel extends Model { protected $table = 'prova'; protected $primaryKey = 'id'; protected $returnType = 'array'; protected $useSoftDeletes = false; //With false work?? RE: Problem with Model()->find() and Model()->findAll() - Anwar - 05-16-2020 Indeed, also in my case, on using: protected $useSoftDeletes = false; it worked. RE: Problem with Model()->find() and Model()->findAll() - ledesma90 - 06-14-2020 (05-16-2020, 04:44 AM)Anwar Wrote: Indeed, also in my case, on using: The same thing happened to me, I did not understand what happened, then look at the code and in the direction "system \ Model.php" change the line 369 "$ builder-> where ($ this-> table. '.'. $ this-> deletedField, null); " by $ builder-> where ('('. $ this-> table. '.'. $ this-> deletedField. "is null or". $ this-> table. '.'. $ this-> deletedField. ' = 0) '); only return results if delete_at column is null by default and change to allow with null and 0 |