init
This commit is contained in:
+38
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Magento\TestModuleGraphQlQueryExtension\Model\Resolver;
|
||||
|
||||
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
|
||||
use Magento\Framework\GraphQl\Config\Element\Field;
|
||||
use Magento\Framework\GraphQl\Query\ResolverInterface;
|
||||
|
||||
/**
|
||||
* Class IntegerList
|
||||
*/
|
||||
class IntegerList implements ResolverInterface
|
||||
{
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function resolve(
|
||||
Field $field,
|
||||
$context,
|
||||
ResolveInfo $info,
|
||||
array $value = null,
|
||||
array $args = null
|
||||
) {
|
||||
if (!isset($value['item_id'])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$itemId = $value['item_id'];
|
||||
|
||||
$resultData = [$itemId + 1, $itemId + 2, $itemId + 3];
|
||||
return $resultData;
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
-->
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
|
||||
<module name="Magento_TestModuleGraphQlQueryExtension" />
|
||||
</config>
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
# Copyright © Magento, Inc. All rights reserved.
|
||||
# See COPYING.txt for license details.
|
||||
|
||||
type TestItemOutput {
|
||||
integer_list: [Int] @resolver(class: "Magento\\TestModuleGraphQlQueryExtension\\Model\\Resolver\\IntegerList")
|
||||
}
|
||||
|
||||
type MutationItemOutput {
|
||||
integer_list: [Int] @resolver(class: "Magento\\TestModuleGraphQlQueryExtension\\Model\\Resolver\\IntegerList")
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
use Magento\Framework\Component\ComponentRegistrar;
|
||||
|
||||
$registrar = new ComponentRegistrar();
|
||||
if ($registrar->getPath(ComponentRegistrar::MODULE, 'Magento_TestModuleGraphQlQueryExtension') === null) {
|
||||
ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_TestModuleGraphQlQueryExtension', __DIR__);
|
||||
}
|
||||
Reference in New Issue
Block a user