CodeDredd / pinia-orm

The Pinia plugin to enable Object-Relational Mapping access to the Pinia Store.
https://pinia-orm.codedredd.de/
MIT License
444 stars 38 forks source link

fix(pinia-orm): Two same `belongsToMany` with inverse keys on same model are causing wrong saved data #1860

Closed CodeDredd closed 4 months ago

CodeDredd commented 4 months ago

🔗 Linked issue

resolves #1857

📚 Description

This edge case is causing wrong saved data if defined on the same model:

...
          retailers: this.belongsToMany(Client, ClientRetailer, 'supplierId', 'retailerId'),
          suppliers: this.belongsToMany(Client, ClientRetailer, 'retailerId', 'supplierId'),
...
codecov-commenter commented 4 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 99.76%. Comparing base (4872cc7) to head (9ede84a).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1860 +/- ## ======================================= Coverage 99.76% 99.76% ======================================= Files 88 88 Lines 6032 6032 Branches 512 512 ======================================= Hits 6018 6018 Misses 12 12 Partials 2 2 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.