In Legacy Storage Content gateway methods loadRelations() and loadReverseRelations() do not limit the result to the published Content. Only loadReverseRelations() limit the related Content to the current version.
This is not sufficient and results in incorrect data returned in two cases:
- when Content is in ARCHIVED state
- when Content has only first (unpublished) draft
test case is:
1- two objects A, B
2- object A has object relations, B is included
3- on frontend, open object A, B shows as related
4- with a command, show list of related objects to A: B is included
5- in admin, remove B to trash
6- reload A in front end, B is gone
7- with the command B still shows in the relations list
the command to used to test can be found here: https://gist.github.com/pbras/8453875
it's a simplified version of the example case found in documentation here:
the same result is shown in step 7 even if in 5 the objects is removed completely. clear caches from command line, admin, or even removing them from disk will not have any effect.