Skip to content
This repository was archived by the owner on Jul 11, 2023. It is now read-only.
This repository was archived by the owner on Jul 11, 2023. It is now read-only.

Can't install on Magento 2 enterprise version. #3

@tarasovd

Description

@tarasovd

UpgradeData script failing on Magento 2 enterprise.

Fix:

diff --git a/Setup/UpgradeData.php b/Setup/UpgradeData.php
index db4f834..8b0f43c 100644
--- a/Setup/UpgradeData.php
+++ b/Setup/UpgradeData.php
@@ -319,7 +319,6 @@ class UpgradeData implements UpgradeDataInterface
 
     protected function setDefaultIsImportedValuesForExistingCategories(ModuleDataSetupInterface $setup)
     {
-        $existingCategoryIds = $this->categoryCollection->getAllIds();
         $isImportedAttributeId = $this->eavAttribute->getIdByCode(Category::ENTITY, InstallData::IS_IMPORTED);
 
         if (empty($existingCategoryIds)) {
@@ -328,8 +327,17 @@ class UpgradeData implements UpgradeDataInterface
 
         $connection = $setup->getConnection();
         $tableName = $setup->getTable('catalog_category_entity_int');
-        $columnName = 'entity_id';
-        $fkColumnName = $connection->tableColumnExists($tableName, $columnName) ? $columnName : 'row_id';
+        $hasRowId = $connection->tableColumnExists($tableName, 'row_id');
+        $fkColumnName = $hasRowId ? 'row_id' : 'entity_id';
+        $existingCategoryIds = [];
+
+        if ($hasRowId) {
+            $existingCategoryIds = $this->categoryCollection
+                ->addFieldToSelect('row_id')
+                ->getColumnValues('row_id');
+        } else {
+            $existingCategoryIds = $this->categoryCollection->getAllIds();
+        }
 
         $data = [];

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions