Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions
CanonicalUrl Class Reference
Inheritance diagram for CanonicalUrl:
ResolverInterface

Public Member Functions

 resolve (Field $field, $context, ResolveInfo $info, array $value=null, array $args=null)
 

Detailed Description

Resolve data for product canonical URL

Definition at line 19 of file CanonicalUrl.php.

Member Function Documentation

◆ resolve()

resolve ( Field  $field,
  $context,
ResolveInfo  $info,
array  $value = null,
array  $args = null 
)

Fetches the data from persistence models and format it according to the GraphQL schema.

Parameters
\Magento\Framework\GraphQl\Config\Element\Field$field
ContextInterface$context
ResolveInfo$info
array | null$value
array | null$args
Exceptions

Implements ResolverInterface.

Definition at line 24 of file CanonicalUrl.php.

30  {
31  if (!isset($value['model'])) {
32  throw new GraphQlInputException(__('"model" value should be specified'));
33  }
34 
35  /* @var $product Product */
36  $product = $value['model'];
37  $url = $product->getUrlModel()->getUrl($product, ['_ignore_category' => true]);
38 
39  return $url;
40  }
__()
Definition: __.php:13
$value
Definition: gender.phtml:16

The documentation for this class was generated from the following file: