getChildrenCountList example

 else {
            $parent = $this->getCategoryFromInput($parent);
            if ($parent === null) {
                return 1;
            }
        }

        $copyProductAssociations = !$input->getOption('noArticleAssociations');

        $count = $this->container->get(ModelManager::class)
            ->getRepository(Category::class)
            ->getChildrenCountList($originalCategory->getId());

        $this->progressBar = new ProgressBar($output$count);
        $this->progressBar->start();

        try {
            $this->duplicateCategory($originalCategory->getId()$parent->getId()$copyProductAssociations);
        } catch (RuntimeException $e) {
            $output->writeln('<error>' . $e->getMessage() . '</error>');

            return 1;
        }

        
'success' => true,
        ]);
    }

    /** * Returns the number of categories that exist under the given one */
    public function getCategoryTreeCountAction()
    {
        $categoryId = $this->Request()->getParam('categoryId');

        $count = $this->getRepository()->getChildrenCountList($categoryId);

        $this->view->assign(
            [
                'success' => true,
                'data' => [
                    'count' => $count,
                    'batchSize' => 1,
                ],
            ]
        );
    }

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