protected function execute(InputInterface $input, OutputInterface $output)
{
$this->detectMagento($output, true);
if (!$this->initMagento()) {
return;
}
$entityType = $input->getArgument('entityType');
try {
$attributes = \Mage::getModel('eav/config')->getEntityAttributeCodes($entityType);
} catch (\Mage_Core_Exception $e) {
throw new InvalidArgumentException($e->getMessage());
}
$setup = new \Mage_Eav_Model_Entity_Setup('core_setup');
foreach ($input->getArgument('attributeCode') as $attributeCode) {
if (!in_array($attributeCode, $attributes)) {
$message = sprintf('Attribute: "%s" does not exist for entity type: "%s"', $attributeCode, $entityType);
$output->writeln(sprintf('<comment>%s</comment>', $message));
} else {
$setup->removeAttribute($entityType, $attributeCode);
$output->writeln(sprintf('<info>Successfully removed attribute: "%s" from entity type: "%s"</info>', $attributeCode, $entityType));
}
}
}