Skip to content

Fixed - category list API return some null values #26792 #30429

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: 2.4-develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<?php


namespace Magento\Catalog\Setup\Patch\Data;


use Magento\Catalog\Setup\CategorySetupFactory;
use Magento\Framework\Setup\ModuleDataSetupInterface;
use Magento\Framework\Setup\Patch\DataPatchInterface;
use Magento\Framework\Setup\Patch\PatchVersionInterface;

/**
* Class UpdateDefaultCategoryIsActive
* @package Magento\Catalog\Setup\Patch\Data
*/
class UpdateDefaultCategoryIsActive implements DataPatchInterface, PatchVersionInterface
{
/**
* @var ModuleDataSetupInterface
*/
private $moduleDataSetup;

/**
* @var CategorySetupFactory
*/
private $categorySetupFactory;

/**
* @param ModuleDataSetupInterface $moduleDataSetup
* @param CategorySetupFactory $categorySetupFactory
*/
public function __construct(
ModuleDataSetupInterface $moduleDataSetup,
CategorySetupFactory $categorySetupFactory
) {
$this->moduleDataSetup = $moduleDataSetup;
$this->categorySetupFactory = $categorySetupFactory;
}

/**
* @inheritdoc
*/
public function apply()
{
/** @var \Magento\Catalog\Setup\CategorySetup $categorySetup */
$categorySetup = $this->categorySetupFactory->create(['setup' => $this->moduleDataSetup]);
$rootCategoryId = \Magento\Catalog\Model\Category::TREE_ROOT_ID;

// Create Root Catalog Node
$categorySetup->createCategory()
->load($rootCategoryId)
->setIsActive(1)
->save();

return $this;
}

/**
* @inheritdoc
*/
public static function getDependencies()
{
return [
SetNewResourceModelsPaths::class,
];
}

/**
* @inheritdoc
*/
public static function getVersion()
{
return '2.4.1';
}

/**
* @inheritdoc
*/
public function getAliases()
{
return [];
}
}