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 🙂

dorsetdigital

It might be worth asking in the #ecommerce channel too. Wilr and Bummzack certainly use that a lot

Nik

Sounds good. I was hoping to grab @wilr tomorrow and talk about my changes, as they might make for a good PR. But I don't know if there's reasons for the existing layout

dorsetdigital

A couple of the contributors on that package are often in here, so if they pop up I'll point them at this question