MichalKleiner

filterByCallback() is slow for significant number of items

andante

think you are going to need to do some looping

Tamara

Perhaps it's easier with a custom query?

Tamara
Tamara 🍕 in #ss4 2019-06-26 12:16:46 (edited) (deleted)
  1. if ($this->B()->count() < 2) {
  2. // do something
  3. }
Kong Jin Jie

Question:

A has_many B, B has_one A B has_many C, C has_one B

I want to get Bs that have less than two Cs. I tried something like this. Did I missed out anything?

  1. // $this being A
  2. $this->B()->filter([
  3. 'C.Count:LessThan' => 2,
  4. ]);
Nik

I'll get in touch sometime tomorrow 🙂