Magento 2 - Getting Order By ID hangs
-
25-12-2020 - |
Question
I have the following class
<?php
namespace Company\Module\Plugin;
class myClass
{
protected $_orderRepository;
public function __construct(
\Magento\Sales\Api\OrderRepositoryInterface $orderRepository,
) {
$this->_orderRepository = $orderRepository;
}
public function processOrder($orderId)
{
$order = $this->_orderRepository->get($orderId);
var_dump($order->getItems());
exit;
}
}
However when it gets to running "$order = $this->_orderRepository->get($orderId);" then my system runs out of memory. Am I doing anything wrong?
Solution
var_dump is not an good idea to check Object.
That why you are getting hangup.You need to use X-debug for this
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange