You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"many_many through relation {$parentClass}.{$component}{$key} references a polymorphic field "
. "{$joinClass}::{$relation} which is not supported"
);
There are a few non-trivial challenges here. The 'to' side of the relation is used as the $dataClass when constructing a ManyManyThroughList. If $dataClass === DataObject::class, that causes a number of issues with with the underlying DataQuery logic as there’s obviously no DataObject table it can run queries on.
The text was updated successfully, but these errors were encountered:
I'm not convinced this is something we should support.
The case where from is not polymorphic, but to is.... just swap those around so the from is the polymorphic instead. That's supported.
The case where from and to are both polymorphic I think would be extremely difficult to do, and probably is a sign that the relation needs to be better thought out anyway.
I know this is a super old issue but @kinglozzer can you think of a good use case for this that isn't supported by the existing functionality?
Affected Version
4.x
Description
Polymorphic many-many-through currently only supports a polymorphic 'from' part, not 'to'. For example:
This triggers an error on
dev/build
:silverstripe-framework/src/ORM/DataObjectSchema.php
Lines 1156 to 1160 in c5d3f82
There are a few non-trivial challenges here. The 'to' side of the relation is used as the
$dataClass
when constructing aManyManyThroughList
. If$dataClass === DataObject::class
, that causes a number of issues with with the underlyingDataQuery
logic as there’s obviously noDataObject
table it can run queries on.The text was updated successfully, but these errors were encountered: