如何在 Doctrine 上自定义 FOREIGN KEY 消息? Api 平台
How to custom FOREIGN KEY message on Doctrine? Api platform
是否可以显示一条消息而不是这条消息?
An exception occurred while executing 'DELETE FROM plan WHERE id = ?' with params [9]:\n\nSQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails (`api`.`request`, CONSTRAINT `FK_3B978F9FE899029B` FOREIGN KEY (`plan_id`) REFERENCES `plan` (`id`))
我想通过消息“你不能删除它,因为它在别处使用”来阻止删除
我找到了解决方案
* @UniqueEntity("request")
是否可以显示一条消息而不是这条消息?
An exception occurred while executing 'DELETE FROM plan WHERE id = ?' with params [9]:\n\nSQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails (`api`.`request`, CONSTRAINT `FK_3B978F9FE899029B` FOREIGN KEY (`plan_id`) REFERENCES `plan` (`id`))
我想通过消息“你不能删除它,因为它在别处使用”来阻止删除
我找到了解决方案
* @UniqueEntity("request")