Skip to content

Commit e0f4132

Browse files
committed
url_rewrites attribute moved to UrlRewriteGraphQl module
1 parent dfabfe5 commit e0f4132

File tree

4 files changed

+11
-8
lines changed

4 files changed

+11
-8
lines changed

app/code/Magento/CatalogGraphQl/etc/schema.graphqls

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,6 @@ interface ProductInterface @typeResolver(class: "Magento\\CatalogGraphQl\\Model\
280280
manufacturer: Int @doc(description: "A number representing the product's manufacturer")
281281
categories: [CategoryInterface] @doc(description: "The categories assigned to a product") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Categories")
282282
canonical_url: String @doc(description: "Canonical URL") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\CanonicalUrl")
283-
url_rewrites: [UrlRewrite] @doc(description: "URL rewrites list") @resolver(class: "Magento\\UrlRewriteGraphQl\\Model\\Resolver\\UrlRewrite")
284283
}
285284

286285
interface PhysicalProductInterface @typeResolver(class: "Magento\\CatalogGraphQl\\Model\\ProductInterfaceTypeResolverComposite") @doc(description: "PhysicalProductInterface contains attributes specific to tangible products") {
@@ -541,6 +540,6 @@ type SortField {
541540
}
542541

543542
type SortFields @doc(description: "SortFields contains a default value for sort fields and all available sort fields") {
544-
default: String @doc(description: "Default value of sort fields")
543+
default: String @doc(description: "Default value of sort fields")
545544
options: [SortField] @doc(description: "Available sort fields")
546545
}

app/code/Magento/UrlRewriteGraphQl/Model/Resolver/EntityUrl.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
use Magento\UrlRewriteGraphQl\Model\Resolver\UrlRewrite\CustomUrlLocatorInterface;
1818

1919
/**
20-
* UrlRewrite field resolver, used for GraphQL request processing.
20+
* The resolver returns the canonical URL for a specified product, category or CMS page
2121
*/
2222
class EntityUrl implements ResolverInterface
2323
{
@@ -35,7 +35,7 @@ class EntityUrl implements ResolverInterface
3535
* @var ValueFactory
3636
*/
3737
private $valueFactory;
38-
38+
3939
/**
4040
* @var CustomUrlLocatorInterface
4141
*/
@@ -72,7 +72,7 @@ public function resolve(
7272
$result = function () {
7373
return null;
7474
};
75-
75+
7676
if (isset($args['url'])) {
7777
$url = $args['url'];
7878
if (substr($url, 0, 1) === '/' && $url !== '/') {
@@ -112,7 +112,7 @@ private function findCanonicalUrl(string $requestPath) : ?\Magento\UrlRewrite\Se
112112
if (!$urlRewrite) {
113113
$urlRewrite = $this->findUrlFromTargetPath($requestPath);
114114
}
115-
115+
116116
return $urlRewrite;
117117
}
118118

app/code/Magento/UrlRewriteGraphQl/Model/Resolver/UrlRewrite.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
use Magento\UrlRewrite\Service\V1\Data\UrlRewrite as UrlRewriteDTO;
1818

1919
/**
20-
* UrlRewrite field resolver, used for GraphQL request processing.
20+
* Returns URL rewrites list for the specified product
2121
*/
2222
class UrlRewrite implements ResolverInterface
2323
{
@@ -63,7 +63,7 @@ public function resolve(
6363
/** @var AbstractModel $entity */
6464
$entity = $value['model'];
6565
$entityId = $entity->getEntityId();
66-
66+
6767
$urlRewritesCollection = $this->urlFinder->findAllByData([UrlRewriteDTO::ENTITY_ID => $entityId]);
6868
$urlRewrites = [];
6969

app/code/Magento/UrlRewriteGraphQl/etc/schema.graphqls

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,7 @@ type HttpQueryParameter @doc(description: "The object details of target path par
2323
name: String @doc(description: "Parameter name")
2424
value: String @doc(description: "Parameter value")
2525
}
26+
27+
interface ProductInterface {
28+
url_rewrites: [UrlRewrite] @doc(description: "URL rewrites list") @resolver(class: "Magento\\UrlRewriteGraphQl\\Model\\Resolver\\UrlRewrite")
29+
}

0 commit comments

Comments
 (0)