Problem with Model()->find() and Model()->findAll() |
(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.
<?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??
Indeed, also in my case, on using:
protected $useSoftDeletes = false; it worked.
(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 |
Welcome Guest, Not a member yet? Register Sign In |