Php Yii2 deplop-TypeError:无效';在';操作数obj错误
我正在使用Kartik DepDrop小部件作为下拉选项。我已经成功地显示了选项 但我的firebug控制台中出现了这样的错误Php Yii2 deplop-TypeError:无效';在';操作数obj错误,php,yii2,dropdown,kartik-v,Php,Yii2,Dropdown,Kartik V,我正在使用Kartik DepDrop小部件作为下拉选项。我已经成功地显示了选项 但我的firebug控制台中出现了这样的错误 TypeError: invalid 'in' operand obj 这是我的密码: 视图: 型号: TransactionType.php public static function getOptions(){ $data= static::find()->all(); $value=(count($data)==0)? [''=>''
TypeError: invalid 'in' operand obj
这是我的密码:
视图:
型号:
TransactionType.php
public static function getOptions(){
$data= static::find()->all();
$value=(count($data)==0)? [''=>'']: \yii\helpers\ArrayHelper::map($data, 'id','name');
return $value;
}
public static function getOptionsbyTransactionType($parent_id) {
$data = static::find()->where(['transaction_type_id'=>$parent_id])->select(['id','name'])->asArray()->all();
$value = (count($data) == 0) ? ['' => ''] : $data;
return $value;
}
DocumentType.php
public static function getOptions(){
$data= static::find()->all();
$value=(count($data)==0)? [''=>'']: \yii\helpers\ArrayHelper::map($data, 'id','name');
return $value;
}
public static function getOptionsbyTransactionType($parent_id) {
$data = static::find()->where(['transaction_type_id'=>$parent_id])->select(['id','name'])->asArray()->all();
$value = (count($data) == 0) ? ['' => ''] : $data;
return $value;
}
错误的含义是什么?我如何修复它?这是再现问题的最小示例吗?请参阅。@dash2谢谢您的建议,我将很快更新我的问题。谢谢