Fixes #5544 - Allow new data to be injected into entity if query performed

Followup of #5547. Splitted part of #5539. Simpletests pass.