N98\Magento\Command\Eav\Attribute\ViewCommand::execute PHP Method

execute() protected method

protected execute ( Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output ) : integer | void
$input Symfony\Component\Console\Input\InputInterface
$output Symfony\Component\Console\Output\OutputInterface
return integer | void
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->detectMagento($output);
        if (!$this->initMagento()) {
            return;
        }
        $entityType = $input->getArgument('entityType');
        $attributeCode = $input->getArgument('attributeCode');
        $attribute = $this->getAttribute($entityType, $attributeCode);
        if (!$attribute) {
            throw new InvalidArgumentException('Attribute was not found.');
        }
        $table = array(array('ID', $attribute->getId()), array('Code', $attribute->getName()), array('Attribute-Set-ID', $attribute->getAttributeSetId()), array('Visible-On-Front', $attribute->getIsVisibleOnFront() ? 'yes' : 'no'), array('Attribute-Model', $attribute->getAttributeModel() ? $attribute->getAttributeModel() : ''), array('Backend-Model', $attribute->getBackendModel() ? $attribute->getBackendModel() : ''), array('Backend-Table', $attribute->getBackendTable() ? $attribute->getBackendTable() : ''), array('Backend-Type', $attribute->getBackendType() ? $attribute->getBackendType() : ''), array('Source-Model', $attribute->getSourceModel() ? $attribute->getSourceModel() : ''), array('Cache-ID-Tags', $attribute->getCacheIdTags() ? implode(',', $attribute->getCacheIdTags()) : ''), array('Cache-Tags', $attribute->getCacheTags() ? implode(',', $attribute->getCacheTags()) : ''), array('Default-Value', $attribute->getDefaultValue() ? $attribute->getDefaultValue() : ''), array('Flat-Columns', $attribute->getFlatColumns() ? implode(',', array_keys($attribute->getFlatColumns())) : ''), array('Flat-Indexes', $attribute->getFlatIndexes() ? implode(',', $attribute->getFlatIndexes()) : ''));
        if ($attribute->getFrontend()) {
            $table[] = array('Frontend-Label', $attribute->getFrontend()->getLabel());
            $table[] = array('Frontend-Class', trim($attribute->getFrontend()->getClass()));
            $table[] = array('Frontend-Input', trim($attribute->getFrontend()->getInputType()));
            $table[] = array('Frontend-Input-Renderer-Class', trim($attribute->getFrontend()->getInputRendererClass()));
        }
        $this->getHelper('table')->setHeaders(array('Type', 'Value'))->renderByFormat($output, $table, $input->getOption('format'));
    }