Yii2:在多个 where 条件下的 findone() 语法



我有一个ipd_charges列的表格

表 - ipd_charges

id    doctor room_category charges_cash charges_cashless
1        1          1              200            300
2        1          2              300            400

表 - patient_admission

id patient_name tpa_name(if not null, equivalent to charges_cashless)
1        1        Null
2        2         1

表daily_ward_entry

id  patient_name  room_name  doctor_name charges ( from ipd charges)
1          1           1           1         200
2          2           2           1         400

我正在尝试使用此失败的查询:

$model = appmodelsIpdCharges::find()
         ->where(['doctor'=>$id])
         ->andwhere(['room_category'=>$this->room_name])->one();

谢谢。如果需要更多信息,请告诉我。

帮助将不胜感激。

请检查

以下代码:

$ipdCharges = new IpdCharges();
$ipdCharges->findOne(['doctor' => $id, 'room_category' => $this->room_name]);

最新更新