| @@ 828-836 (lines=9) @@ | ||
| 825 | ]); |
|
| 826 | $this->addErrors($message); |
|
| 827 | } else { |
|
| 828 | foreach ($Category->getPath() as $ParentCategory) { |
|
| 829 | if (!isset($categoriesIdList[$ParentCategory->getId()])) { |
|
| 830 | $ProductCategory = $this->makeProductCategory($Product, $ParentCategory, $sortNo); |
|
| 831 | $this->entityManager->persist($ProductCategory); |
|
| 832 | $sortNo++; |
|
| 833 | ||
| 834 | $Product->addProductCategory($ProductCategory); |
|
| 835 | $categoriesIdList[$ParentCategory->getId()] = true; |
|
| 836 | } |
|
| 837 | } |
|
| 838 | if (!isset($categoriesIdList[$Category->getId()])) { |
|
| 839 | $ProductCategory = $this->makeProductCategory($Product, $Category, $sortNo); |
|
| @@ 500-509 (lines=10) @@ | ||
| 497 | $Categories = $form->get('Category')->getData(); |
|
| 498 | $categoriesIdList = []; |
|
| 499 | foreach ($Categories as $Category) { |
|
| 500 | foreach ($Category->getPath() as $ParentCategory) { |
|
| 501 | if (!isset($categoriesIdList[$ParentCategory->getId()])) { |
|
| 502 | $ProductCategory = $this->createProductCategory($Product, $ParentCategory, $count); |
|
| 503 | $this->entityManager->persist($ProductCategory); |
|
| 504 | $count++; |
|
| 505 | /* @var $Product \Eccube\Entity\Product */ |
|
| 506 | $Product->addProductCategory($ProductCategory); |
|
| 507 | $categoriesIdList[$ParentCategory->getId()] = true; |
|
| 508 | } |
|
| 509 | } |
|
| 510 | if (!isset($categoriesIdList[$Category->getId()])) { |
|
| 511 | $ProductCategory = $this->createProductCategory($Product, $Category, $count); |
|
| 512 | $this->entityManager->persist($ProductCategory); |
|