[Forwardport] Update shipment collection to unserialize packages attribute after load
#18231
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Original Pull Request
#17679
Description
The column
packagesinsales_shipmentis in its resource model\Magento\Sales\Model\ResourceModel\Order\Shipmentcharacterized as a serializable field. Butpackagesdoesn't get unserialized when shipments are loaded with a collection. This pull request fixes the issue by unserializing the field after the collection is loaded.Manual testing scenarios
packagesis in my case set to[].packagesis a string, but should be an array.In this example the same shipment is loaded with 1.) the shipment repository and 2.) the shipment collection. The output is:
This consequently causes further problems if the shipment loaded with the shipment collection is being updated, because
packagesgets saved as"[]"(the quotation marks are now a part of the string).packagesnow can't get unserialized when it's loaded with any method. Also an error is shown if this shipment is opened in the backend because an array is expected but a string is given:Contribution checklist