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