Yii2: findone () syntax for set where condition

I have an ipd_charges table with columns

table - ipd_charges

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

      

table - patient_admission

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

      

table daily_ward_entry

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

      

I'm trying to use this query, which doesn't work:

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

      

Thank. Please tell me if you need more information.

Help would be greatly appreciated.

+3


source to share


1 answer


Please check the code below:



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

      

+6


source







All Articles