protected function execute(InputInterface $input, OutputInterface $output)
{
$this->detectMagento($output, true);
if (!$this->initMagento()) {
return;
}
try {
$entityType = $input->getArgument('entityType');
$attributeCode = $input->getArgument('attributeCode');
$attribute = $this->getAttribute($entityType, $attributeCode);
$generator = Attribute\EntityType\Factory::create($entityType, $attribute);
$generator->setReadConnection($this->_getModel('core/resource', 'Mage_Core_Model_Resource')->getConnection('core_read'));
$code = $generator->generateCode();
$warnings = $generator->getWarnings();
$output->writeln(implode(PHP_EOL, $warnings) . PHP_EOL . $code);
} catch (Exception $e) {
$output->writeln('<error>' . $e->getMessage() . '</error>');
}
}