Code Duplication    Length = 9-10 lines in 2 locations

src/Eccube/Controller/Admin/Product/CsvImportController.php 1 location

@@ 728-736 (lines=9) @@
725
                if (!$Category) {
726
                    $this->addErrors(($data->key() + 1).'行目の商品カテゴリ(ID)「'.$category.'」が存在しません。');
727
                } else {
728
                    foreach($Category->getPath() as $ParentCategory){
729
                        if (!isset($categoriesIdList[$ParentCategory->getId()])){
730
                            $ProductCategory = $this->makeProductCategory($Product, $ParentCategory, $rank);
731
                            $app['orm.em']->persist($ProductCategory);
732
                            $rank++;
733
                            $Product->addProductCategory($ProductCategory);
734
                            $categoriesIdList[$ParentCategory->getId()] = true;
735
                        }
736
                    }
737
                    if (!isset($categoriesIdList[$Category->getId()])){
738
                        $ProductCategory = $this->makeProductCategory($Product, $Category, $rank);
739
                        $rank++;

src/Eccube/Controller/Admin/Product/ProductController.php 1 location

@@ 368-377 (lines=10) @@
365
                $Categories = $form->get('Category')->getData();
366
                $categoriesIdList = array();
367
                foreach ($Categories as $Category) {
368
                    foreach($Category->getPath() as $ParentCategory){
369
                        if (!isset($categoriesIdList[$ParentCategory->getId()])){
370
                            $ProductCategory = $this->createProductCategory($Product, $ParentCategory, $count);
371
                            $app['orm.em']->persist($ProductCategory);
372
                            $count++;
373
                            /* @var $Product \Eccube\Entity\Product */
374
                            $Product->addProductCategory($ProductCategory);
375
                            $categoriesIdList[$ParentCategory->getId()] = true;
376
                        }
377
                    }
378
                    if (!isset($categoriesIdList[$Category->getId()])){
379
                        $ProductCategory = $this->createProductCategory($Product, $Category, $count);
380
                        $app['orm.em']->persist($ProductCategory);