示例#1
0
 public function getLastReservation()
 {
     return $this->hasOne(Reservation::className(), ['room_id' => 'id'])->orderBy(['id' => SORT_DESC]);
 }
示例#2
0
 public function getReservationsCount()
 {
     return $this->hasMany(Reservation::className(), ['customer_id' => 'id'])->count();
 }