Open JeRoNZ opened 7 years ago
Is this the same as what I was scratching my head on here? https://github.com/concrete5-community-store/community_store/issues/167
It sounds like exactly the issue I observed, yes. The two changes fixed it for me. I'm a bit of a noob at this ORM stuff, but it does seem to be the case that it's easy to detach or unmerge an object from ORM, such as might happen when creating a new instance of the entity manager, and that leads to a new record being inserted.
The code I ended up with is here: https://github.com/JeRoNZ/community_store_shipping_nz_flat_rate
I used this as an example (thanks) to build a shipping method. However, I found that repeated saves of the method through the dashboard lead to one record for each attempt.
The fix is to use the same ORM mechanism as used in the bundled community store methods, ie: