protected function execute(InputInterface $input, OutputInterface $output)
{
$this->detectMagento($output);
if (!$this->initMagento()) {
return;
}
$table = array();
$attributesCollection = \Mage::getResourceModel('eav/entity_attribute_collection');
$attributesCollection->setOrder('attribute_code', 'asc');
foreach ($attributesCollection as $attribute) {
$entityType = $this->_getEntityType($attribute);
/**
* Filter by type
*/
if ($input->getOption('filter-type') !== null && $input->getOption('filter-type') !== $entityType) {
continue;
}
$row = array();
$row[] = $attribute->getAttributeCode();
$row[] = $attribute->getId();
$row[] = $entityType;
$row[] = $attribute->getFrontendLabel();
if ($input->getOption('add-source')) {
$row[] = $attribute->getSourceModel() ? $attribute->getSourceModel() : '';
}
if ($input->getOption('add-backend')) {
$row[] = $attribute->getBackendType();
}
$table[] = $row;
}
$headers = array();
$headers[] = 'code';
$headers[] = 'id';
$headers[] = 'entity_type';
$headers[] = 'label';
if ($input->getOption('add-source')) {
$headers[] = 'source';
}
if ($input->getOption('add-backend')) {
$headers[] = 'backend_type';
}
$this->getHelper('table')->setHeaders($headers)->renderByFormat($output, $table, $input->getOption('format'));
}