@@ 693-697 (lines=5) @@ | ||
690 | /** @var $Category Category */ |
|
691 | $Category = new Category(); |
|
692 | if (isset($row[$headerByKey['id']]) && strlen($row[$headerByKey['id']]) > 0) { |
|
693 | if (!preg_match('/^\d+$/', $row[$headerByKey['id']])) { |
|
694 | $this->addErrors(($data->key() + 1).'行目のカテゴリIDが存在しません。'); |
|
695 | ||
696 | return $this->renderWithError($form, $headers); |
|
697 | } |
|
698 | $Category = $this->categoryRepository->find($row[$headerByKey['id']]); |
|
699 | if (!$Category) { |
|
700 | $this->addErrors(($data->key() + 1).'行目のカテゴリIDが存在しません。'); |
|
@@ 741-745 (lines=5) @@ | ||
738 | ||
739 | $ParentCategory = null; |
|
740 | if (isset($row[$headerByKey['parent_category_id']]) && StringUtil::isNotBlank($row[$headerByKey['parent_category_id']])) { |
|
741 | if (!preg_match('/^\d+$/', $row[$headerByKey['parent_category_id']])) { |
|
742 | $this->addErrors(($data->key() + 1).'行目の親カテゴリIDが存在しません。'); |
|
743 | ||
744 | return $this->renderWithError($form, $headers); |
|
745 | } |
|
746 | ||
747 | /** @var $ParentCategory Category */ |
|
748 | $ParentCategory = $this->categoryRepository->find($row[$headerByKey['parent_category_id']]); |
|
@@ 759-763 (lines=5) @@ | ||
756 | ||
757 | // Level |
|
758 | if (isset($row['階層']) && StringUtil::isNotBlank($row['階層'])) { |
|
759 | if ($ParentCategory == null && $row['階層'] != 1) { |
|
760 | $this->addErrors(($data->key() + 1).'行目の親カテゴリIDが存在しません。'); |
|
761 | ||
762 | return $this->renderWithError($form, $headers); |
|
763 | } |
|
764 | $level = StringUtil::trimAll($row['階層']); |
|
765 | } else { |
|
766 | $level = 1; |