-
-
Notifications
You must be signed in to change notification settings - Fork 92
Incomplete/inexact documentation on how to update a "transient" entity. #389
Description
I’m writing this here in case someone encounters the same situation as me, and I can save them a few minutes of searching.
Specifically, my situation is that I have an entity that comes from a database view (non-updatable). After working with it, I want to update one of its related entities (one that does have a direct representation in a database table).
To do this, I could perform a find of the entity in the database, make a modification, and then do an update, but this is not optimal since I already have the data needed for the update from the object representing the view.
After some research, I found that the factory(array $row) function in the SQL Mapper, which is marked as protected in the documentation, is actually public and can be used to create an attached object where modifications are pushed to the database when performing an update.
In my opinion, the documentation for copyfrom and factory should reference each other, explaining their differences and when to use each one.