我正在尝试根据类型字段在此处创建条件选择。为什么$exp->addCase()
调用无效并且它说那addCase()
是未知方法?
$query->select(function ($exp) use ($query) {
$concatPerson = $query->func()->concat(['lastname' => 'literal', ', ', 'firstnames' => 'literal']);
return $exp->addCase(
[
$query->newExpr()->eq('type', 1),
$query->newExpr()->eq('type', 2),
],
[$concatPerson, 'business_name'],
['string', 'string']
);
});