Skip to content

Commit b04e9d2

Browse files
committed
ACP2E-2857: fix failing graphql requests
1 parent 4af113a commit b04e9d2

File tree

3 files changed

+103
-1
lines changed

3 files changed

+103
-1
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
/**
3+
* Copyright 2024 Adobe
4+
* All Rights Reserved.
5+
*
6+
* NOTICE: All information contained herein is, and remains
7+
* the property of Adobe and its suppliers, if any. The intellectual
8+
* and technical concepts contained herein are proprietary to Adobe
9+
* and its suppliers and are protected by all applicable intellectual
10+
* property laws, including trade secret and copyright laws.
11+
* Dissemination of this information or reproduction of this material
12+
* is strictly forbidden unless prior written permission is obtained
13+
* from Adobe.
14+
*/
15+
declare(strict_types=1);
16+
17+
namespace Magento\Catalog\Model\Category\Attribute\Backend;
18+
19+
class DefaultSortby extends Sortby
20+
{
21+
}
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
<?php
2+
/**
3+
* Copyright 2024 Adobe
4+
* All Rights Reserved.
5+
*
6+
* NOTICE: All information contained herein is, and remains
7+
* the property of Adobe and its suppliers, if any. The intellectual
8+
* and technical concepts contained herein are proprietary to Adobe
9+
* and its suppliers and are protected by all applicable intellectual
10+
* property laws, including trade secret and copyright laws.
11+
* Dissemination of this information or reproduction of this material
12+
* is strictly forbidden unless prior written permission is obtained
13+
* from Adobe.
14+
*/
15+
declare(strict_types=1);
16+
17+
namespace Magento\Catalog\Setup\Patch\Data;
18+
19+
use Magento\Catalog\Setup\CategorySetup;
20+
use Magento\Catalog\Setup\CategorySetupFactory;
21+
use Magento\Framework\Setup\ModuleDataSetupInterface;
22+
use Magento\Framework\Setup\Patch\DataPatchInterface;
23+
24+
class UpdateDefaultSortyByBackendType implements DataPatchInterface
25+
{
26+
/**
27+
* @var ModuleDataSetupInterface
28+
*/
29+
private $moduleDataSetup;
30+
31+
/**
32+
* @var CategorySetupFactory
33+
*/
34+
private $categorySetupFactory;
35+
36+
/**
37+
* PatchInitial constructor.
38+
* @param ModuleDataSetupInterface $moduleDataSetup
39+
* @param CategorySetupFactory $categorySetupFactory
40+
*/
41+
public function __construct(
42+
ModuleDataSetupInterface $moduleDataSetup,
43+
CategorySetupFactory $categorySetupFactory
44+
) {
45+
$this->moduleDataSetup = $moduleDataSetup;
46+
$this->categorySetupFactory = $categorySetupFactory;
47+
}
48+
49+
/**
50+
* @inheritdoc
51+
*/
52+
public function apply()
53+
{
54+
$mediaBackendModel = \Magento\Catalog\Model\Category\Attribute\Backend\DefaultSortby::class;
55+
/** @var CategorySetup $categorySetup */
56+
$categorySetup = $this->categorySetupFactory->create(['setup' => $this->moduleDataSetup]);
57+
$categorySetup->updateAttribute(
58+
'catalog_category',
59+
'default_sort_by',
60+
'backend_model',
61+
$mediaBackendModel
62+
);
63+
}
64+
65+
/**
66+
* @inheritdoc
67+
*/
68+
public static function getDependencies()
69+
{
70+
return [];
71+
}
72+
73+
/**
74+
* @inheritdoc
75+
*/
76+
public function getAliases()
77+
{
78+
return [];
79+
}
80+
}

app/code/Magento/Catalog/etc/di.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,8 @@
739739
<item name="Magento\Catalog\Model\Product\Attribute\Backend\Sku" xsi:type="string">string</item>
740740
<item name="Magento\Catalog\Model\Product\Attribute\Backend\Category" xsi:type="string">int[]</item>
741741
<item name="Magento\Catalog\Model\Product\Attribute\Backend\Stock" xsi:type="string">Magento\CatalogInventory\Api\Data\StockItemInterface[]</item>
742-
<item name="Magento\Catalog\Model\Category\Attribute\Backend\Sortby" xsi:type="string">string</item>
742+
<item name="Magento\Catalog\Model\Category\Attribute\Backend\Sortby" xsi:type="string">string[]</item>
743+
<item name="Magento\Catalog\Model\Category\Attribute\Backend\DefaultSortby" xsi:type="string">string</item>
743744
</argument>
744745
</arguments>
745746
</type>

0 commit comments

Comments
 (0)