@@ 740-748 (lines=9) @@ | ||
737 | if (!$Category) { |
|
738 | $this->addErrors(($data->key() + 1).'行目の商品カテゴリ(ID)「'.$category.'」が存在しません。'); |
|
739 | } else { |
|
740 | foreach($Category->getPath() as $ParentCategory){ |
|
741 | if (!isset($categoriesIdList[$ParentCategory->getId()])){ |
|
742 | $ProductCategory = $this->makeProductCategory($Product, $ParentCategory, $rank); |
|
743 | $app['orm.em']->persist($ProductCategory); |
|
744 | $rank++; |
|
745 | $Product->addProductCategory($ProductCategory); |
|
746 | $categoriesIdList[$ParentCategory->getId()] = true; |
|
747 | } |
|
748 | } |
|
749 | if (!isset($categoriesIdList[$Category->getId()])){ |
|
750 | $ProductCategory = $this->makeProductCategory($Product, $Category, $rank); |
|
751 | $rank++; |
@@ 392-401 (lines=10) @@ | ||
389 | $Categories = $form->get('Category')->getData(); |
|
390 | $categoriesIdList = array(); |
|
391 | foreach ($Categories as $Category) { |
|
392 | foreach ($Category->getPath() as $ParentCategory) { |
|
393 | if (!isset($categoriesIdList[$ParentCategory->getId()])) { |
|
394 | $ProductCategory = $this->createProductCategory($Product, $ParentCategory, $count); |
|
395 | $app['orm.em']->persist($ProductCategory); |
|
396 | $count++; |
|
397 | /* @var $Product \Eccube\Entity\Product */ |
|
398 | $Product->addProductCategory($ProductCategory); |
|
399 | $categoriesIdList[$ParentCategory->getId()] = true; |
|
400 | } |
|
401 | } |
|
402 | if (!isset($categoriesIdList[$Category->getId()])) { |
|
403 | $ProductCategory = $this->createProductCategory($Product, $Category, $count); |
|
404 | $app['orm.em']->persist($ProductCategory); |