getCategoryFromInput example



    /** * {@inheritdoc} */
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->input = $input;
        $this->output = $output;

        /** @var Category|null $originalCategory */
        $originalCategory = $this->getCategoryFromInput($input->getArgument('category'));

        if ($originalCategory === null) {
            return 1;
        }

        if ((int) $originalCategory->getId() === 1) {
            $output->writeln('<error>Cannot duplicate root category</error>');

            return 1;
        }

        
Home | Imprint | This part of the site doesn't use cookies.