|
@@ 736-740 (lines=5) @@
|
| 733 |
|
/** @var $Category Category */ |
| 734 |
|
$Category = new Category(); |
| 735 |
|
if (isset($row[$headerByKey['id']]) && strlen($row[$headerByKey['id']]) > 0) { |
| 736 |
|
if (!preg_match('/^\d+$/', $row[$headerByKey['id']])) { |
| 737 |
|
$this->addErrors(($data->key() + 1).'行目のカテゴリIDが存在しません。'); |
| 738 |
|
|
| 739 |
|
return $this->renderWithError($form, $headers); |
| 740 |
|
} |
| 741 |
|
$Category = $this->categoryRepository->find($row[$headerByKey['id']]); |
| 742 |
|
if (!$Category) { |
| 743 |
|
$this->addErrors(($data->key() + 1).'行目の更新対象のカテゴリIDが存在しません。新規登録の場合は、カテゴリIDの値を空で登録してください。'); |
|
@@ 784-788 (lines=5) @@
|
| 781 |
|
|
| 782 |
|
$ParentCategory = null; |
| 783 |
|
if (isset($row[$headerByKey['parent_category_id']]) && StringUtil::isNotBlank($row[$headerByKey['parent_category_id']])) { |
| 784 |
|
if (!preg_match('/^\d+$/', $row[$headerByKey['parent_category_id']])) { |
| 785 |
|
$this->addErrors(($data->key() + 1).'行目の親カテゴリIDが存在しません。'); |
| 786 |
|
|
| 787 |
|
return $this->renderWithError($form, $headers); |
| 788 |
|
} |
| 789 |
|
|
| 790 |
|
/** @var $ParentCategory Category */ |
| 791 |
|
$ParentCategory = $this->categoryRepository->find($row[$headerByKey['parent_category_id']]); |
|
@@ 802-806 (lines=5) @@
|
| 799 |
|
|
| 800 |
|
// Level |
| 801 |
|
if (isset($row['階層']) && StringUtil::isNotBlank($row['階層'])) { |
| 802 |
|
if ($ParentCategory == null && $row['階層'] != 1) { |
| 803 |
|
$this->addErrors(($data->key() + 1).'行目の親カテゴリIDが存在しません。'); |
| 804 |
|
|
| 805 |
|
return $this->renderWithError($form, $headers); |
| 806 |
|
} |
| 807 |
|
$level = StringUtil::trimAll($row['階層']); |
| 808 |
|
} else { |
| 809 |
|
$level = 1; |