collectionFactory = $collectionFactory; $this->checkCustomerAccount = $checkCustomerAccount; } /** * @inheritdoc */ public function resolve( Field $field, $context, ResolveInfo $info, array $value = null, array $args = null ) { $customerId = $context->getUserId(); $this->checkCustomerAccount->execute($customerId, $context->getUserType()); $items = []; $orders = $this->collectionFactory->create($customerId); /** @var \Magento\Sales\Model\Order $order */ foreach ($orders as $order) { $items[] = [ 'id' => $order->getId(), 'increment_id' => $order->getIncrementId(), 'created_at' => $order->getCreatedAt(), 'grand_total' => $order->getGrandTotal(), 'status' => $order->getStatus(), ]; } return ['items' => $items]; } }