-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Closed
Labels
Component: SalesFixed in 2.2.xThe issue has been fixed in 2.2 release lineThe issue has been fixed in 2.2 release lineIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.1.xThe issue has been reproduced on latest 2.1 releaseThe issue has been reproduced on latest 2.1 releaseReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 releaseThe issue has been reproduced on latest 2.3 releasebug report
Description
When adding a Track to a Shipment programmatically.
Preconditions
- Magento 2.1.1
- PHP 5.6.24
Steps to reproduce
- Load or create a Shipment model
/** @var $shipment \Magento\Sales\Model\Order\Shipment */
$shipmentCollection = $this->_objectManager->get(
'Magento\Sales\Model\ResourceModel\Order\Shipment\CollectionFactory'
)->create();
$shipment = $shipmentCollection->getFirstItem();
-
Make a call
$shipment->getTracks(); -
Create a Track model and try to add it to the Shipment
/** @var $track \Magento\Sales\Model\Order\Shipment\Track */
$track = $this->_objectManager->get(
'Magento\Sales\Model\Order\Shipment\TrackFactory'
)->create();
$track->setNumber('Test Number')
->setTitle('Test Title')
->setCarrierCode('Test CODE');
$shipment->addTrack($track)->save();
Expected result
- Successfull save
Actual result
You will receive an error Call to a member function addItem() on array because the method getTracksCollection() in Shipment model will return an array instead of Collection Object.
Metadata
Metadata
Assignees
Labels
Component: SalesFixed in 2.2.xThe issue has been fixed in 2.2 release lineThe issue has been fixed in 2.2 release lineIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.1.xThe issue has been reproduced on latest 2.1 releaseThe issue has been reproduced on latest 2.1 releaseReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 releaseThe issue has been reproduced on latest 2.3 releasebug report