@@ 591-595 (lines=5) @@ | ||
588 | /** @var $Category Category */ |
|
589 | $Category = new Category(); |
|
590 | if (isset($row[$headerByKey['id']]) && strlen($row[$headerByKey['id']]) > 0) { |
|
591 | if (!preg_match('/^\d+$/', $row[$headerByKey['id']])) { |
|
592 | $this->addErrors(($data->key() + 1).'行目のカテゴリIDが存在しません。'); |
|
593 | ||
594 | return $this->renderWithError($form, $headers); |
|
595 | } |
|
596 | $Category = $this->categoryRepository->find($row[$headerByKey['id']]); |
|
597 | if (!$Category) { |
|
598 | $this->addErrors(($data->key() + 1).'行目のカテゴリIDが存在しません。'); |
|
@@ 639-643 (lines=5) @@ | ||
636 | ||
637 | $ParentCategory = null; |
|
638 | if (isset($row[$headerByKey['parent_category_id']]) && StringUtil::isNotBlank($row[$headerByKey['parent_category_id']])) { |
|
639 | if (!preg_match('/^\d+$/', $row[$headerByKey['parent_category_id']])) { |
|
640 | $this->addErrors(($data->key() + 1).'行目の親カテゴリIDが存在しません。'); |
|
641 | ||
642 | return $this->renderWithError($form, $headers); |
|
643 | } |
|
644 | ||
645 | /** @var $ParentCategory Category */ |
|
646 | $ParentCategory = $this->categoryRepository->find($row[$headerByKey['parent_category_id']]); |
|
@@ 657-661 (lines=5) @@ | ||
654 | ||
655 | // Level |
|
656 | if (isset($row['階層']) && StringUtil::isNotBlank($row['階層'])) { |
|
657 | if ($ParentCategory == null && $row['階層'] != 1) { |
|
658 | $this->addErrors(($data->key() + 1).'行目の親カテゴリIDが存在しません。'); |
|
659 | ||
660 | return $this->renderWithError($form, $headers); |
|
661 | } |
|
662 | $level = StringUtil::trimAll($row['階層']); |
|
663 | } else { |
|
664 | $level = 1; |