EC-CUBE / EC-CUBE/ec-cube

Shipping に紐づいた配送方法を削除しようとするとシステムエラーが発生する

Open
#5,251 4 comments 0 reactions 0 assignees View on GitHub
Status: needs-review
Dominant language
PHP
Stars
788
Forks
719
Avg merge
4d 4h
Merged PRs (30d)
39

Description

## 概要(Overview)
注文が入り、Shipping に紐づいた配送方法を削除しようとするとシステムエラーが発生する

```
[2021-12-10 10:25:05] admin.ERROR [e27fb8fa] [5e92a34] [1] [Eccube\Log\Logger:log:64] - システムエラーが発生しました。 ["An exception occurred while executing 'DELETE FROM dtb_delivery WHERE id = ?' with params [1]:\n\nSQLSTATE[23503]: Foreign key violation: 7 ERROR: update or delete on table \"dtb_delivery\" violates foreign key constraint \"fk_2ebd22ce12136921\" on table \"dtb_shipping\"\nDETAIL: Key (id)=(1) is still referenced from table \"dtb_shipping\".","/var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractPostgreSQLDriver.php",67,"#0 /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php(182): Doctrine\\DBAL\\Driver\\AbstractPostgreSQLDriver->convertException()\n#1 /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php(159): Doctrine\\DBAL\\DBALException::wrapException()\n#2 /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(2212): Doctrine\\DBAL\\DBALException::driverExceptionDuringQuery()\n#3 /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(1524): Doctrine\\DBAL\\Connection->handleExceptionDuringQuery()\n#4 /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(805): Doctrine\\DBAL\\Connection->executeStatement()\n#5 /var/www/html/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php(587): Doctrine\\DBAL\\Connection->delete()\n#6 /var/www/html/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php(1201): Doctrine\\ORM\\Persisters\\Entity\\BasicEntityPersister->delete()\n#7 /var/www/html/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php(424): Doctrine\\ORM\\UnitOfWork->executeDeletions()\n#8 /var/www/html/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php(371): Doctrine\\ORM\\UnitOfWork->commit()\n#9 /var/www/html/var/cache/prod/ContainerKq3TC57/EntityManager_9a5be93.php(86): Doctrine\\ORM\\EntityManager->flush()\n#10 /var/www/html/src/Eccube/Controller/Admin/Setting/Shop/DeliveryController.php(319): EntityManager_9a5be93->flush()\n#11 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(158): Eccube\\Controller\\Admin\\Setting\\Shop\\DeliveryController->delete()\n#12 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(80): Symfony\\Component\\HttpKernel\\HttpKernel->handleRaw()\n#13 /var/www/html/vendor/symfony/http-kernel/Kernel.php(201): Symfony\\Component\\HttpKernel\\HttpKernel->handle()\n#14 /var/www/html/index.php(76): Symfony\\Component\\HttpKernel\\Kernel->handle()\n#15 {main}"] [POST, /admin/setting/shop/delivery/1/delete, 172.28.0.5, https://ec-cube/admin/setting/shop/delivery, Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:94.0) Gecko/20100101 Firefox/94.0]
```

## 期待する内容(Expect) or 要望 (Requirement)
削除できない旨のエラーメッセージを表示する

## 再現手順(Procedure)
1. 注文を登録する
2. 注文に紐づいた配送方法を削除する

### 環境 (environment)
+ EC-CUBE: 4.1.1
+ PHP: 7.4.26
+ DB:
- PostgreSQL 14.1

## 関連情報 (Ref)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.