rinvex / laravel-attributes

⚠️ [ABANDONED] Rinvex Attributable is a robust, intelligent, and integrated Entity-Attribute-Value model (EAV) implementation for Laravel Eloquent, with powerful underlying for managing entity attributes implicitly as relations with ease. It utilizes the power of Laravel Eloquent, with smooth and seamless integration.
MIT License
433 stars 104 forks source link

FIX trash multiple attribute types in one save #101

Closed michal-kusy closed 2 years ago

michal-kusy commented 4 years ago

Fixes issue when trashing/replacing multiple attribute types leads to data integrity issues (deleting IDs in different/first found model) and duplicating data (especially for replace in collections).

Omranic commented 2 years ago

Thank you for the valuable contribution. I did a complete rewrite for the whole package and changed how this feature works. In the new refactor, it actually uses normal relationships, and should be easy and straightforward like default Laravel relationships. Although, that refactor is incomplete.

I'm still not happy with the overall performance (I believe we can reduce number of executed queries), if you want to check it out, see https://github.com/rinvex/laravel-attributes/tree/refactor-to-native-laravel-relationships

Currently no plans to merge that rewrite, but hopefully sometime I can get it to a stable state, improve performance and release it. Any help with that branch would be much appreciated! 🙂

drrcknlsn commented 2 years ago

@Omranic If there is no plan to merge your rewrite, would you reconsider opening this PR back up and merging the fix? The affected code is deleting arbitrary unrelated data, which is a pretty serious issue.

Omranic commented 2 years ago

Done! ✅ @drrcknlsn @michal-kusy