|
@@ 526-530 (lines=5) @@
|
| 523 |
|
/** @var $Category Category */ |
| 524 |
|
$Category = new Category(); |
| 525 |
|
if (isset($row['カテゴリID']) && strlen($row['カテゴリID']) > 0) { |
| 526 |
|
if (!preg_match('/^\d+$/', $row['カテゴリID'])) { |
| 527 |
|
$this->addErrors(($data->key() + 1).'行目のカテゴリIDが存在しません。'); |
| 528 |
|
|
| 529 |
|
return $this->renderWithError($form, $headers); |
| 530 |
|
} |
| 531 |
|
$Category = $this->categoryRepository->find($row['カテゴリID']); |
| 532 |
|
if (!$Category) { |
| 533 |
|
$this->addErrors(($data->key() + 1).'行目のカテゴリIDが存在しません。'); |
|
@@ 537-541 (lines=5) @@
|
| 534 |
|
|
| 535 |
|
return $this->renderWithError($form, $headers); |
| 536 |
|
} |
| 537 |
|
if ($row['カテゴリID'] == $row['親カテゴリID']) { |
| 538 |
|
$this->addErrors(($data->key() + 1).'行目のカテゴリIDと親カテゴリIDが同じです。'); |
| 539 |
|
|
| 540 |
|
return $this->renderWithError($form, $headers); |
| 541 |
|
} |
| 542 |
|
} |
| 543 |
|
|
| 544 |
|
if (isset($row['カテゴリ削除フラグ']) && StringUtil::isNotBlank($row['カテゴリ削除フラグ'])) { |
|
@@ 574-578 (lines=5) @@
|
| 571 |
|
|
| 572 |
|
$ParentCategory = null; |
| 573 |
|
if (isset($row['親カテゴリID']) && StringUtil::isNotBlank($row['親カテゴリID'])) { |
| 574 |
|
if (!preg_match('/^\d+$/', $row['親カテゴリID'])) { |
| 575 |
|
$this->addErrors(($data->key() + 1).'行目の親カテゴリIDが存在しません。'); |
| 576 |
|
|
| 577 |
|
return $this->renderWithError($form, $headers); |
| 578 |
|
} |
| 579 |
|
|
| 580 |
|
/** @var $ParentCategory Category */ |
| 581 |
|
$ParentCategory = $this->categoryRepository->find($row['親カテゴリID']); |
|
@@ 592-596 (lines=5) @@
|
| 589 |
|
|
| 590 |
|
// Level |
| 591 |
|
if (isset($row['階層']) && StringUtil::isNotBlank($row['階層'])) { |
| 592 |
|
if ($ParentCategory == null && $row['階層'] != 1) { |
| 593 |
|
$this->addErrors(($data->key() + 1).'行目の親カテゴリIDが存在しません。'); |
| 594 |
|
|
| 595 |
|
return $this->renderWithError($form, $headers); |
| 596 |
|
} |
| 597 |
|
$level = StringUtil::trimAll($row['階層']); |
| 598 |
|
} else { |
| 599 |
|
$level = 1; |