Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
NewFromTo.php
Go to the documentation of this file.
1 <?php
6 declare(strict_types=1);
7 
9 
15 
19 class NewFromTo implements ResolverInterface
20 {
26  public function resolve(
27  Field $field,
28  $context,
30  array $value = null,
31  array $args = null
32  ) {
33  if (!isset($value['model'])) {
34  throw new GraphQlInputException(__('"model" value should be specified'));
35  }
36 
38  $product = $value['model'];
39  $attributeName = substr_replace($field->getName(), 's', 3, 0);
40 
41  $data = null;
42  if ($product->getData($attributeName)) {
43  $data = $product->getData($attributeName);
44  }
45 
46  return $data;
47  }
48 }
__()
Definition: __.php:13
$value
Definition: gender.phtml:16
foreach( $_productCollection as $_product)() ?>" class $info
Definition: listing.phtml:52
resolve(Field $field, $context, ResolveInfo $info, array $value=null, array $args=null)