| @@ 729-737 (lines=9) @@ | ||
| 726 | if (!$Category) { |
|
| 727 | $this->addErrors(($data->key() + 1).'行目の商品カテゴリ(ID)「'.$category.'」が存在しません。'); |
|
| 728 | } else { |
|
| 729 | foreach($Category->getPath() as $ParentCategory){ |
|
| 730 | if (!isset($categoriesIdList[$ParentCategory->getId()])){ |
|
| 731 | $ProductCategory = $this->makeProductCategory($Product, $ParentCategory, $rank); |
|
| 732 | $app['orm.em']->persist($ProductCategory); |
|
| 733 | $rank++; |
|
| 734 | $Product->addProductCategory($ProductCategory); |
|
| 735 | $categoriesIdList[$ParentCategory->getId()] = true; |
|
| 736 | } |
|
| 737 | } |
|
| 738 | if (!isset($categoriesIdList[$Category->getId()])){ |
|
| 739 | $ProductCategory = $this->makeProductCategory($Product, $Category, $rank); |
|
| 740 | $rank++; |
|
| @@ 370-379 (lines=10) @@ | ||
| 367 | $Categories = $form->get('Category')->getData(); |
|
| 368 | $categoriesIdList = array(); |
|
| 369 | foreach ($Categories as $Category) { |
|
| 370 | foreach($Category->getPath() as $ParentCategory){ |
|
| 371 | if (!isset($categoriesIdList[$ParentCategory->getId()])){ |
|
| 372 | $ProductCategory = $this->createProductCategory($Product, $ParentCategory, $count); |
|
| 373 | $app['orm.em']->persist($ProductCategory); |
|
| 374 | $count++; |
|
| 375 | /* @var $Product \Eccube\Entity\Product */ |
|
| 376 | $Product->addProductCategory($ProductCategory); |
|
| 377 | $categoriesIdList[$ParentCategory->getId()] = true; |
|
| 378 | } |
|
| 379 | } |
|
| 380 | if (!isset($categoriesIdList[$Category->getId()])){ |
|
| 381 | $ProductCategory = $this->createProductCategory($Product, $Category, $count); |
|
| 382 | $app['orm.em']->persist($ProductCategory); |
|