N98\Magento\Command\Cms\Block\ToggleCommand::execute PHP Метод

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

Execute the command
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;
        }
        $blockId = $input->getArgument('block_id');
        if (is_numeric($blockId)) {
            $block = $this->_getBlockModel()->load($blockId);
        } else {
            $block = $this->_getBlockModel()->load($blockId, 'identifier');
        }
        if (!$block->getId()) {
            return $output->writeln('<error>Block was not found</error>');
        }
        $newStatus = !$block->getIsActive();
        $block->setIsActive($newStatus)->save();
        $output->writeln(sprintf('<comment>Block</comment> <info>%s</info>', $newStatus ? 'enabled' : 'disabled'));
    }