出现这个错误;
[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'
]
最佳答案
假设 Order
有一个命名空间,您没有正确引用它。试试这个:
private static $has_many = [
'OrderRegistrants' => Order::class . '.Registrant',
];
这将确保为 Order
类导入的任何命名空间(例如通过 use My\Package\Order;
)都将得到尊重。您获得它的方式不会考虑任何命名空间。
关于php - silverstripe 4 has_many 关系给出错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51414166/