$book = $this->getBookingOptions()->indexBy('session')->all();
public function getBookingOptions()
{
return $this->hasMany(BookingOption::className(), ['booking_id' => 'id']);
}
$this->bookingCount=Stub::make($this->bookingCount,['getBookingOptions'=>new BookingOption]);
[yii\base\UnknownMethodException] Calling unknown method: app\models\BookingOption::indexBy
$booking = Stub::make('Booking', [
'getBookingOptions' => function () { return [new BookingOption()]; }
]);