• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem with Model()->find() and Model()->findAll()

#1
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.

For example, i have model UserModel which based on BaseModel which extends Model. 

PHP Code:
class UserModel extends BaseModel
{

    private $user_uploads_dir;

    private $user_avatar_uri;

    protected $table      'users';

    protected $primaryKey 'id';

    protected $returnType 'array';

    protected $useTimestamps true;

    protected $dateFormat 'int';

    protected $createdField  'created';

    protected $updatedField  null;

    protected $deletedField 'deleted';

    protected $useSoftDeletes true;



Table users has 1 row with id = 1
When i try to get row from DB with find() or findAll() i get Null result. I don't known why it's happening.

PHP Code:
$items = (new UserModel())->find(1); // will be null 


PHP Code:
$items = (new UserModel())->where('id'1)->get()->getRowArray(); // will be array with user data 

Tell me, please, what i doing wrong? I created issue on github.com, but jimm-parry redirect me to this forum. 
Reply


Messages In This Thread
Problem with Model()->find() and Model()->findAll() - by workoverflow - 10-06-2019, 12:03 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.