- 🇩🇪Germany Anybody Porta Westfalica
This still blocks https://www.drupal.org/project/commerce_pvt →
So is there any plan to merge this finally?
@mglaman is still self-assigned.
- 🇮🇹Italy eglaw Cittadella
@Anybody if i only knew ... the only things they've told me is that basically this mechanism adds complications on a simple thing, and it probably doesn't fit into basic commerce usage.
- Issue was unassigned.
- 🇩🇪Germany Anybody Porta Westfalica
@mglaman is an official statement possible here perhaps? So the community at least knows what's going to happen! Looks like a lot of time and brain went into this, so would be sad to let it die like this...
- Status changed to Needs review
10 months ago 11:11am 27 November 2024 - 🇩🇪Germany Anybody Porta Westfalica
- 🇮🇹Italy eglaw Cittadella
@anybody
I will check and update as soon as commerce 3.x stable will roll out. - 🇺🇸United States mradcliffe USA
I think this is still relevant because hack Solution #3 which is in commerce_cart.module seems to be broken for me in Commerce 3.0.2 (3.1.0 not tried).
The Entity Type definition is being cached without the add_to_cart form handler and this causes EntityTypeManager via ProductLazyBuilders to throw an exception. Flushing the cache completely will resolve the issue temporarily, but it seems there are times when the Entity Type definition cache is built without calling hook_entity_type_build or a race condition might be causing it not to get called in time? The site is not using any memory cache, only database cache.
Stack trace:
Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException: The "commerce_order_item" entity type did not specify a "add_to_cart" form class. in Drupal\Core\Entity\EntityTypeManager->getFormObject() (line 212 of core/lib/Drupal/Core/Entity/EntityTypeManager.php). Drupal\commerce_product\ProductLazyBuilders->addToCartForm()
So an improved Order Item Type resolver would be better.
- 🇺🇸United States mradcliffe USA
Th exceptions are due to 🐛 ModuleHandler skips all hook implementations when invoked before the module files have been loaded Needs review which makes using hook_entity_type_build unreliable currently.