API4 throws an exception when using `IN` and pseudoconstants aren't resolved
Consider this API call in mjwshared
(pinging @mattwire since he'll be interested):
$paymentProcessorIDs = \Civi\Api4\PaymentProcessor::get(FALSE)
->addWhere('payment_processor_type_id:name', 'IN', ['Stripe', 'Globalpayments'])
->execute()
This throws a fatal error when run if you don't have Stripe or Globalpayments installed. However, this seems inconsistent:
- If your operator is
=
notIN
, you just get an empty set (e.g.cv api4 PaymentProcessor.get +w 'payment_processor_type_id:name = "fake processor"'
). - If your operator is
IN
but you're not using pseudoconstant lookup, you get an empty set, e.g.cv api4 PaymentProcessor.get +w 'payment_processor_type_id IN [123456,234567]'
.
From a DX perspective, I think the correct result on the code in mjwshared
is to return an empty set.