We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Can define relationship with additional condition?

I have 3 models: OrderTypeA(order_id), OrderTypeB(order_id), Invoice(invoice_id, invoice_order_type, invoice_order_id) . Are there any ways to define relationships between OrderTypeA and Invoice, OrderTypeB and Invoice via pair (order_id, invoice_order_id) with additional condition (order_type_id)? Can anyone help me resolve this?