Developer
Developer

Reputation: 1

Cakephp 3 Cannot convert value to bool issue

I am execute flowing query .

$query = $busdetails
      ->find('list',['keyField' => 'id','valueField' => 'bus_name'])
      ->where(['status'=>1,'is_approved'=>1]); 

pr($query->toArray());

It works fine if some results found but if no results found then it shows an error Cannot convert value to bool issue. Thanks

Upvotes: 0

Views: 3098

Answers (1)

Abhishek
Abhishek

Reputation: 1561

update cakephp library file.--

cakephp/src/Database/Type/BoolType.php

Change

if ($value === true || $value === false)

by

if ($value === true || $value === false || is_null($value))

From more detail --

https://github.com/cakephp/cakephp/issues/7583

Upvotes: 1

Related Questions