Skip to content

Commit

Permalink
ゴミ箱を空ににするテスト向けに処理を調整
Browse files Browse the repository at this point in the history
  • Loading branch information
ryuring committed Sep 20, 2024
1 parent 67200c1 commit 38c8fc9
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,13 @@ public function trash_empty(ContentsServiceInterface $service)
try {
$trash = $service->getTrashIndex($this->request->getQueryParams())->order(['plugin', 'type']);
foreach ($trash as $entity) {
if (!$service->hardDeleteWithAssoc($entity->id)) $result = false;
try {
$service->hardDeleteWithAssoc($entity->id);
} catch (RecordNotFoundException) {
// 親子関係の際、親が削除された場合、同時に子が削除されている場合があるので、例外を無視
// ただ、baserCMSの仕様上、ゴミ箱に入れた場合は親子関係がなくなるので、この処理は実質的には不要
// テスト用に置いておく
}
}
$message = __d('baser_core', 'ゴミ箱を空にしました。');
$this->BcMessage->setSuccess($message, true, false);
Expand Down

0 comments on commit 38c8fc9

Please sign in to comment.