Skip to content

Commit

Permalink
Added version check
Browse files Browse the repository at this point in the history
  • Loading branch information
sreichel authored and cmuench committed Jul 13, 2024
1 parent 39f3b62 commit 57135c0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/N98/Magento/Command/Eav/Attribute/RemoveCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,12 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$setup->removeAttribute($entityType, $attributeCode);

// required with EAV attribute caching added in OpenMage 20.1.0
Mage::app()->getCacheInstance()->cleanType('eav');
Mage::dispatchEvent('adminhtml_cache_refresh_type', ['type' => 'eav']);
if (method_exists('Mage', 'getOpenMageVersion')
&& version_compare(Mage::getOpenMageVersion(), '20.1', '>=')
) {
Mage::app()->getCacheInstance()->cleanType('eav');
Mage::dispatchEvent('adminhtml_cache_refresh_type', ['type' => 'eav']);
}

$output->writeln(
sprintf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,11 @@ protected function createAttribute($entityType, $attributeCode, $data)
$setup->addAttribute($entityType, $attributeCode, $data);

// required with EAV attribute caching added in OpenMage 20.1.0
Mage::app()->getCacheInstance()->cleanType('eav');
if (method_exists('Mage', 'getOpenMageVersion')
&& version_compare(Mage::getOpenMageVersion(), '20.1', '>=')
) {
Mage::app()->getCacheInstance()->cleanType('eav');
}
}

/**
Expand Down

0 comments on commit 57135c0

Please sign in to comment.