cakePHP 3 Query ifnull
问题 I wonder what would be the best way to prevent null results in a ResultSet. I'm on cake 3.5.13 and I'm using cases, like: private function addCase($isforeign, $source) { $query = $this->Sales->find(); return $query->newExpr() ->addCase( $query->newExpr()->add([ 'Sales.isforeign' => $isforeign, 'Sales.source' => $source ]), 1, 'integer'); } I then put the return of my addCase function in (..) 'sourcenationalcount' => $query->func()->sum($this->addCase(0, 1)), (..) Now it is possible that