diff --git a/UpgradeData.php b/UpgradeData2.php index 5541ef0c6df..7da88f59762 100644 --- a/UpgradeData.php +++ b/UpgradeData2.php @@ -133,18 +133,16 @@ class UpgradeData implements Setup\UpgradeDataInterface if (version_compare($context->getVersion(), '8.1.11') < 0) { /** @var CategorySetup $eavSetup */ $eavSetup = $this->categorySetupFactory->create(['setup' => $setup]); $entityTypeId = $eavSetup->getEntityTypeId(Product::ENTITY); - if ($eavSetup->getAttribute($entityTypeId, ProductFeed::INCLUDE_IN_FEED_FLAG)) { - $eavSetup->updateAttribute( - $entityTypeId, - 'bv_feed_exclude', - 'note', - 'Not applicable to DCC' - ); - } + $eavSetup->updateAttribute( + $entityTypeId, + 'bv_feed_exclude', + 'note', + 'Not applicable to DCC' + ); } if (version_compare($context->getVersion(), '8.3.0') < 0) { $this->encryptPasswordConfig(ScopeConfigInterface::SCOPE_TYPE_DEFAULT); @@ -170,35 +168,33 @@ class UpgradeData implements Setup\UpgradeDataInterface 'attribute_code', 'bv_feed_include' //just fixes the code to reflect that it's been used as an include flag for years ); } - if ($eavSetup->getAttribute($entityTypeId, ProductFeed::INCLUDE_IN_FEED_FLAG)) { - $eavSetup->updateAttribute( + $eavSetup->updateAttribute( + $entityTypeId, + ProductFeed::INCLUDE_IN_FEED_FLAG, + 'default', + Boolean::VALUE_YES + ); + foreach ($eavSetup->getAllAttributeSetIds() as $attributeSetId) { + if (!$eavSetup->getAttributeGroup($entityTypeId, $attributeSetId, 'Bazaarvoice')) { + $eavSetup->addAttributeGroup($entityTypeId, $attributeSetId, 'Bazaarvoice'); + } + $attributeGroupId = $eavSetup->getAttributeGroupId($entityTypeId, $attributeSetId, 'Bazaarvoice'); + $eavSetup->addAttributeToGroup( $entityTypeId, - ProductFeed::INCLUDE_IN_FEED_FLAG, - 'default', - Boolean::VALUE_YES + $attributeSetId, + $attributeGroupId, + ProductFeed::INCLUDE_IN_FEED_FLAG + ); + $eavSetup->addAttributeToGroup( + $entityTypeId, + $attributeSetId, + $attributeGroupId, + ProductFeed::CATEGORY_EXTERNAL_ID ); - foreach ($eavSetup->getAllAttributeSetIds() as $attributeSetId) { - if (!$eavSetup->getAttributeGroup($entityTypeId, $attributeSetId, 'Bazaarvoice')) { - $eavSetup->addAttributeGroup($entityTypeId, $attributeSetId, 'Bazaarvoice'); - } - $attributeGroupId = $eavSetup->getAttributeGroupId($entityTypeId, $attributeSetId, 'Bazaarvoice'); - $eavSetup->addAttributeToGroup( - $entityTypeId, - $attributeSetId, - $attributeGroupId, - ProductFeed::INCLUDE_IN_FEED_FLAG - ); - $eavSetup->addAttributeToGroup( - $entityTypeId, - $attributeSetId, - $attributeGroupId, - ProductFeed::CATEGORY_EXTERNAL_ID - ); - } } } } /**