|
@@ 525-529 (lines=5) @@
|
| 522 |
|
/** @var $Category Category */ |
| 523 |
|
$Category = new Category(); |
| 524 |
|
if (isset($row['カテゴリID']) && strlen($row['カテゴリID']) > 0) { |
| 525 |
|
if (!preg_match('/^\d+$/', $row['カテゴリID'])) { |
| 526 |
|
$this->addErrors(($data->key() + 1).'行目のカテゴリIDが存在しません。'); |
| 527 |
|
|
| 528 |
|
return $this->renderWithError($form, $headers); |
| 529 |
|
} |
| 530 |
|
$Category = $this->categoryRepository->find($row['カテゴリID']); |
| 531 |
|
if (!$Category) { |
| 532 |
|
$this->addErrors(($data->key() + 1).'行目のカテゴリIDが存在しません。'); |
|
@@ 536-540 (lines=5) @@
|
| 533 |
|
|
| 534 |
|
return $this->renderWithError($form, $headers); |
| 535 |
|
} |
| 536 |
|
if ($row['カテゴリID'] == $row['親カテゴリID']) { |
| 537 |
|
$this->addErrors(($data->key() + 1).'行目のカテゴリIDと親カテゴリIDが同じです。'); |
| 538 |
|
|
| 539 |
|
return $this->renderWithError($form, $headers); |
| 540 |
|
} |
| 541 |
|
} |
| 542 |
|
|
| 543 |
|
if (!isset($row['カテゴリ名']) || StringUtil::isBlank($row['カテゴリ名'])) { |
|
@@ 553-557 (lines=5) @@
|
| 550 |
|
|
| 551 |
|
$ParentCategory = null; |
| 552 |
|
if (isset($row['親カテゴリID']) && StringUtil::isNotBlank($row['親カテゴリID'])) { |
| 553 |
|
if (!preg_match('/^\d+$/', $row['親カテゴリID'])) { |
| 554 |
|
$this->addErrors(($data->key() + 1).'行目の親カテゴリIDが存在しません。'); |
| 555 |
|
|
| 556 |
|
return $this->renderWithError($form, $headers); |
| 557 |
|
} |
| 558 |
|
|
| 559 |
|
/** @var $ParentCategory Category */ |
| 560 |
|
$ParentCategory = $this->categoryRepository->find($row['親カテゴリID']); |
|
@@ 571-575 (lines=5) @@
|
| 568 |
|
|
| 569 |
|
// Level |
| 570 |
|
if (isset($row['階層']) && StringUtil::isNotBlank($row['階層'])) { |
| 571 |
|
if ($ParentCategory == null && $row['階層'] != 1) { |
| 572 |
|
$this->addErrors(($data->key() + 1).'行目の親カテゴリIDが存在しません。'); |
| 573 |
|
|
| 574 |
|
return $this->renderWithError($form, $headers); |
| 575 |
|
} |
| 576 |
|
$level = StringUtil::trimAll($row['階層']); |
| 577 |
|
} else { |
| 578 |
|
$level = 1; |