Ticket 13724

This resolves an issue where when calling a method that writes to the database through some kind of relationship manager, the ORM was failing to call db_for_write in some cases.

Much thanks to @freakboy3742 and @jacobian without whom I'd have been completely lost poking around in the ORM