storm icon indicating copy to clipboard operation
storm copied to clipboard

Multiple changes to improve support for relationship pivot data

Open LukeTowers opened this issue 3 years ago • 0 comments

Pivot::fromAttributes() instead of new Pivot(): https://github.com/laravel/framework/commit/06f01cf50f5060bd23b16d8c651869c97a43f139 & https://github.com/laravel/framework/commit/4b30aad8539f300bfa35394d1d86a760b15389c5

(protected) Pivot()->parent -> (public) Pivot()->pivotParent: https://github.com/laravel/framework/commit/29a181fd64a1d07e071351e61e8403bf00ea4b3c & https://github.com/laravel/framework/commit/22c3c022faea8796a74dc537ec260ec3f839bf5b

$otherKey -> $relatedKey: https://github.com/laravel/framework/commit/d2a77776295cb155b985526c1fa1fddc190adb07

Added fromRawAttributes() method to Pivot: https://github.com/laravel/framework/commit/f356419fa6f6b6fbc3322ca587b0bc1e075ba8d2

Various improvements to setKeysForSaveQuery(): https://github.com/laravel/framework/commit/8d826189bb2db1c177d8605eb9218daa973acb6a, https://github.com/laravel/framework/commit/e9f37edb195870d74cf92b06e589ab7154963e2a

Fire model events when deleting Pivot models: https://github.com/laravel/framework/pull/27571

Fixed Pivot serialization: https://github.com/laravel/framework/commit/b52d3143c6b4b5eacbb21a5c83873fd1d43289e9 & https://github.com/laravel/framework/pull/31956

TODO:

  • [x] Replace current implementation with use of AsPivot trait from Laravel to avoid duplicating logic (double check for changes between Laravel 6.x and 9.x and apply fixes as required to Laravel 9 WIP branch
  • [ ] https://github.com/octobercms/october/issues/3485
  • [ ] https://github.com/octobercms/october/issues/2747
  • [ ] Review HasRelationships trait methods used to spawn new relation objects for parameter naming & docblocks
  • [ ] Document change of otherKey to relatedKey
  • [ ] Add changes to release notes

LukeTowers avatar Jan 24 '22 00:01 LukeTowers