0

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

cursorrux
  • 1,382
  • 4
  • 9
  • 20
Developer
  • 1
  • 1
  • 1

1 Answers1

0

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

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Abhishek
  • 1,543
  • 3
  • 13
  • 29
  • Given that this is the actual problem, the solution should be to update the CakePHP dependency, not to make manual changes in the core that are going to be lost with the next update! – ndm Mar 30 '16 at 06:32