Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught Error: Call to a member function addItem() on array in app/code/Magento/Sales/Model/Order/Shipment.php #8022

Closed
raisaev opened this issue Jan 3, 2017 · 5 comments
Assignees
Labels
bug report Component: Sales Fixed in 2.2.x The issue has been fixed in 2.2 release line Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release

Comments

@raisaev
Copy link

raisaev commented Jan 3, 2017

When adding a Track to a Shipment programmatically.

Preconditions

  1. Magento 2.1.1
  2. PHP 5.6.24

Steps to reproduce

  1. 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();
  1. Make a call
    $shipment->getTracks();

  2. 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

  1. 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.

@xmav
Copy link
Contributor

xmav commented Jan 25, 2017

@raisaev Thanks for reporting this issue.
We've created internal ticket MAGETWO-63653 to address this issue.

@xmav xmav removed their assignment Jan 25, 2017
@xmav xmav added 2.0.x Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development labels Jan 25, 2017
@titechnologies
Copy link

Is it solved yet ?

@magento-engcom-team magento-engcom-team added 2.0.x Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development bug report Component: Sales Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed and removed G1 Passed labels Sep 5, 2017
@magento-engcom-team
Copy link
Contributor

@raisaev, thank you for your report.
We've created internal ticket(s) MAGETWO-63653 to track progress on the issue.

@magento-engcom-team magento-engcom-team added 2.2.x Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed labels Oct 13, 2017
@RomaKis RomaKis self-assigned this Oct 24, 2017
okorshenko pushed a commit that referenced this issue Nov 12, 2017
…em() on array in app/code/Magento/Sales/Model/Order/Shipment.php #11680

 - Merge Pull Request #11680 from RomaKis/magento2:8022
 - Merged commits:
   1. 44021e7
   2. 0f317bf
   3. 12a234a
okorshenko pushed a commit that referenced this issue Nov 12, 2017
…em() on array in app/code/Magento/Sales/Model/Order/Shipment.php #11680
@okorshenko
Copy link
Contributor

The issue has been fixed and delivered to 2.2-develop branch. Will be available with 2.2.2 release

@okorshenko okorshenko added the Fixed in 2.2.x The issue has been fixed in 2.2 release line label Nov 13, 2017
@ferraramax
Copy link

in wich way we can solve in 2.2.1?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report Component: Sales Fixed in 2.2.x The issue has been fixed in 2.2 release line Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release
Projects
None yet
Development

No branches or pull requests

10 participants