From 06092acf687ac7127d0f4a393cc6eb98f22c9d45 Mon Sep 17 00:00:00 2001 From: Lorenzo Ruozzi Date: Mon, 31 Aug 2026 15:51:07 +0200 Subject: [PATCH] Allow deleting a bundle item which has already been ordered Product bundles remove their items with orphan removal, but ProductBundleOrderItem referenced them through a non nullable join column with no on delete behaviour. Removing a product from a bundle therefore failed with a foreign key constraint violation as soon as that bundle item had been ordered at least once: SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails (`bitbag_product_bundle_order_item`, CONSTRAINT `FK_A615CDA9B7FE950B` FOREIGN KEY (`product_bundle_item_id`) REFERENCES `bitbag_product_bundle_item` (`id`)) Order items already store the ordered product variant and its quantity, and the association is already typed as nullable on both the entity and its interface, so the reference can simply be set to null when the bundle item is deleted, leaving order history intact. Applications need a migration for the schema change: the plugin ships none. Co-Authored-By: Claude Opus 5 (1M context) --- config/doctrine/ProductBundleOrderItem.orm.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/doctrine/ProductBundleOrderItem.orm.xml b/config/doctrine/ProductBundleOrderItem.orm.xml index 47a6eeb6..64da4cb5 100644 --- a/config/doctrine/ProductBundleOrderItem.orm.xml +++ b/config/doctrine/ProductBundleOrderItem.orm.xml @@ -29,7 +29,7 @@ - +