TimestampBehavior::class, 'attributes' => [ ActiveRecord::EVENT_BEFORE_INSERT => ['created_at','updated_at'], ActiveRecord::EVENT_BEFORE_UPDATE => ['updated_at'], ], ], ]; } /** * 获取分院信息 * @return ActiveQuery */ public function getYard(): ActiveQuery { return $this->hasOne(HospitalYard::className(),['id'=>'yard_id'])->select('id,name,position,hospital_id'); } }