Item.php 878 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. declare(strict_types=1);
  7. namespace Magento\TestModuleGraphQlQuery\Model\Resolver;
  8. use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
  9. use Magento\Framework\GraphQl\Config\Element\Field;
  10. use Magento\Framework\GraphQl\Query\ResolverInterface;
  11. class Item implements ResolverInterface
  12. {
  13. /**
  14. * @inheritdoc
  15. */
  16. public function resolve(
  17. Field $field,
  18. $context,
  19. ResolveInfo $info,
  20. array $value = null,
  21. array $args = null
  22. ) {
  23. $id = 0;
  24. foreach ($args as $key => $argValue) {
  25. if ($key === "id") {
  26. $id = (int)$argValue;
  27. }
  28. }
  29. $itemData = [
  30. 'item_id' => $id,
  31. 'name' => "itemName"
  32. ];
  33. return $itemData;
  34. }
  35. }