In my controller i have:
public function index()
{
$streams = $this->Streams->find('all')->where(['user_id'=>2]);
echo $streams->count();
die();
$this->set('streams', $streams);
}
When I set a user_id that has results in databse, it works fine. But when I set a user_id with not results, when I tried to loop the query or even count the results, i get the following error:
InvalidArgumentException Cannot convert value to bool
Any ideas? Thanks all!