3

getting this error;

[Emergency] Uncaught InvalidArgumentException: has_many relation abc\def\ghi\Customer.OrderRegistrants references class Order which doesn't exist

 private static $has_many = [
        'OrderRegistrants'      => 'Order.Registrant'
]
scrowler
  • 24,273
  • 9
  • 60
  • 92
kosala manojeewa
  • 329
  • 3
  • 11

1 Answers1

2

Assuming Order has a namespace, you're not referencing it correctly. Try this:

private static $has_many = [
    'OrderRegistrants'      => Order::class . '.Registrant',
];

This will ensure that any imported (via use My\Package\Order; for example) namespaces for the Order class will be honoured. The way you've got it won't take any namespaces into account.

scrowler
  • 24,273
  • 9
  • 60
  • 92