The use of stubs when activeQuery queries?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
33 views
as for stabity code like this
$book = $this->getBookingOptions()->indexBy('session')->all(); public function getBookingOptions() { return $this->hasMany(BookingOption::className(), ['booking_id' => 'id']); }

doing so
$this->bookingCount=Stub::make($this->bookingCount,['getBookingOptions'=>new BookingOption]);

get
[yii\\base\\UnknownMethodException] Calling unknown method: app\\models\\BookingOption::indexBy
by | 33 views

1 Answer

0 like 0 dislike
You even the signature of the method were not included, smoke Doku

I assume something like
$booking = Stub::make('Booking', [ 'getBookingOptions' => function () { return [new BookingOption()]; } ]);
by

Related questions

0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
2 answers
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
asked Apr 9, 2019 by pashaa
110,608 questions
257,187 answers
0 comments
40,796 users