[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
packages
insales_shipment
is in its resource model\Magento\Sales\Model\ResourceModel\Order\Shipment
characterized as a serializable field. Butpackages
doesn'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
packages
is in my case set to[]
.packages
is 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
packages
gets saved as"[]"
(the quotation marks are now a part of the string).packages
now 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