Bug #56442
closedInvalid FileReference used
100%
Description
In my domain model (watches) I have this:
family (1:n) familyLine (1:n) watch (1:1) image
Thus a family has some familyLines which in turns have watches and each watch has an associated image (FileReference).
As "image" is a FileReference, column "image" from table "watch" is a counter of how many references are associated, thus "1" in my case since there is only one allowed image to be linked.
familyLines are lazy loaded, watches too and image reference as well.
When I loop over my families in the view, I basically do this:
foreach families as family foreach family.familyLines as familyline show familyline.<first-reference>.image endforeach endforeach
Now, the first image to be loaded will put the corresponding FileReference's uid into memory. In my case this happens to be sys_file_reference row with uid=1. When I loop over the second picture to be retrieved (from lazy loading), it has to map value "1" (which actually is not a uid but a counter) as a FileReference and as such it finds the first FileReference that was retrieved before and it does not load the actual FileReference but the previous one.
In the end this means that it shows the first image instead of the real one.