Let's do the same thing we did for products: #3002474: Make the product-variation relationship more robust

When saving a product we ensure that all referenced variations have the product_id set. However, we don't do the opposite, when saving a variation we don't check that the specified product references the variation. There's no cost to doing so, cause we skip the save if there's nothing to do. We already do this two-way check on promotions and coupons.

This will allow us to create an order item and have it automatically be referenced by an order.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

bojanz created an issue. See original summary.

jsacksick’s picture

Status: Active » Needs review
FileSize
3.34 KB

  • bojanz committed 2bc4486 on 8.x-2.x authored by jsacksick
    Issue #3005070 by jsacksick: Make the order-order_item relationship more...
bojanz’s picture

Status: Needs review » Fixed

Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

mglaman’s picture

After testing, this effectively killed the $save_cart flags in CartManager and causes double saves, and the Order object in CartManager is now stale. See #2656818-23: Implement optimistic locking for orders

bojanz’s picture

Status: Closed (fixed) » Fixed

This issue was meant as a "nice to have", but introduced regressions and complicated the already complicated flow of order&order item saving. I have now reverted it.

Commit: https://cgit.drupalcode.org/commerce/commit/?id=c8fa08b

bojanz’s picture

Title: Make the order-order_item relationship more robust » [Reverted] Make the order-order_item relationship more robust

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.