DataProvider that directly returns a ReferenceToSingle still returns an array
JBlaak opened this issue · comments
Joris Blaak commented
For example:
$domain = Domain::get();
return [
Data::build(
['reseller'],
new ReferenceToSingle(['resellers', $domain->getResellerId()])
)
];
Will return on fetchSingle
:
[
[
//Here the result of the ReferenceToSingle
]
]
Joris Blaak commented
So this isn't a bug, since there are situations which you might want to combine several references. However this can be solve with a solution such as:
$domain = Domain::get();
return new ReferenceToSingle(['resellers', $domain->getResellerId()]);
So you can "alias" a route to another and use that result.