6 declare(strict_types=1);
31 private $objectManager;
36 private $outputMapper;
56 private $wrappedTypeProcessor;
61 private $resolveInfoFactory;
82 $this->outputMapper = $outputMapper;
83 $this->inputMapper = $inputMapper;
84 $this->typeFactory = $typeFactory;
85 $this->scalarTypes = $scalarTypes;
86 $this->wrappedTypeProcessor = $wrappedTypeProcessor;
87 $this->resolveInfoFactory = $resolveInfoFactory;
96 'fields' =>
function () use ($configElement, $outputType) {
98 foreach ($configElement->
getFields() as $field) {
99 $fieldsConfig[$field->getName()] = $this->getFieldConfig($configElement, $outputType, $field);
101 return $fieldsConfig;
117 if ($this->scalarTypes->isScalarType($field->
getTypeName())) {
118 $type = $this->wrappedTypeProcessor->processScalarWrappedType($field);
126 $type = $this->wrappedTypeProcessor->processWrappedType($field,
$type);
139 private function getFieldConfig(
140 TypeInterface $typeConfigElement,
141 OutputTypeInterface $outputType,
144 $type = $this->getFieldType($typeConfigElement, $outputType, $field);
146 'name' => $field->getName(),
150 if (!empty($field->getDescription())) {
151 $fieldConfig[
'description'] = $field->getDescription();
154 if ($field->getResolver() !=
null) {
156 $resolver = $this->objectManager->get($field->getResolver());
158 $fieldConfig[
'resolve'] =
159 function (
$value, $args, $context,
$info) use ($resolver, $field) {
160 $wrapperInfo = $this->resolveInfoFactory->create(
$info);
161 return $resolver->resolve($field, $context, $wrapperInfo,
$value, $args);
164 return $this->formatArguments($field, $fieldConfig);
174 private function formatArguments(Field $field, array
$config) : array
176 foreach ($field->getArguments() as $argument) {
177 $inputType = $this->inputMapper->getRepresentation($argument);
179 $config[
'args'][$argument->getName()] = $inputType;
foreach( $_productCollection as $_product)() ?>" class $info