N98\Magento\Command\Eav\Attribute\RemoveCommand::execute PHP Метод

execute() защищенный Метод

protected execute ( Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output ) : integer | null | void
$input Symfony\Component\Console\Input\InputInterface
$output Symfony\Component\Console\Output\OutputInterface
Результат integer | null | void
    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));
            }
        }
    }