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
Any version including StandardRelatedDataService (Silverstripe 4 and 5).
Description
There are multiple cases in which the StandardRelatedDataService does not work (Undefined index) or return wrong results. I do understand that the DataService is marked for internal use and might be not intended for use with other DataObjects than Files. Nevertheless these issues also occur if Files are used in complex relationships.
Case 1
There is no support for polymorphic relations besides the Parent relation. If polymorphic relations are involved there will be no filtering by class, resulting in wrong related data returned.
Given the the following DataObject structure for a Many-many-through Relation between X and Y by class B:
A:
has_one:
x: XB: #extends Ahas_one:
y: Y
The service won't be able to find the configuration for x as it uses the uninherited config of B which does not include the relation to X, resulting in an Undefined index see:
The text was updated successfully, but these errors were encountered:
sb-relaxt-at
changed the title
StandardRelatedDataService not working for generic DataObjects
StandardRelatedDataService not working for complex relations
Nov 24, 2023
Affected Version
Any version including
StandardRelatedDataService
(Silverstripe 4 and 5).Description
There are multiple cases in which the
StandardRelatedDataService
does not work (Undefined index
) or return wrong results. I do understand that the DataService is marked for internal use and might be not intended for use with other DataObjects than Files. Nevertheless these issues also occur if Files are used in complex relationships.Case 1
There is no support for polymorphic relations besides the
Parent
relation. If polymorphic relations are involved there will be no filtering by class, resulting in wrong related data returned.silverstripe-framework/src/ORM/RelatedData/StandardRelatedDataService.php
Line 120 in 26c8c0f
silverstripe-framework/src/ORM/RelatedData/StandardRelatedDataService.php
Line 231 in 26c8c0f
silverstripe-framework/src/ORM/RelatedData/StandardRelatedDataService.php
Line 318 in 26c8c0f
silverstripe-framework/src/ORM/RelatedData/StandardRelatedDataService.php
Line 371 in 26c8c0f
Case 2
Given the the following DataObject structure for a Many-many-through Relation between X and Y by class B:
The service won't be able to find the configuration for
x
as it uses the uninherited config of B which does not include the relation to X, resulting in anUndefined index
see:silverstripe-framework/src/ORM/RelatedData/StandardRelatedDataService.php
Line 417 in 26c8c0f
Edit: Fixed a wrong relation in the example.
The text was updated successfully, but these errors were encountered: