cancel
Showing results for 
Search instead for 
Did you mean: 

Unknown entity type: Magento\Bundle\Model\Selection\Interceptor requested

Unknown entity type: Magento\Bundle\Model\Selection\Interceptor requested

Got error Unknown entity type: Magento\Bundle\Model\Selection\Interceptor requested when create a bundle product.

1 REPLY 1

Re: Unknown entity type: Magento\Bundle\Model\Selection\Interceptor requested

Looks like it's a core bug, EntityManager does not properly work with Models which have plugins (Interceptors).
The solution looks trivial, I created the following patch for `magento/framework` , you'd may want to use it (to know how to apply patches see this)

From 2ae6bcd2f80d2a9cf4a703dc9aa8c2e81b7eeeb6 Mon Sep 17 00:00:00 2001
From: Laurentiu Tofan <laurentiu.tofan@y1.de>
Date: Mon, 18 Oct 2021 14:12:18 +0200
Subject: [PATCH] fix(entity-manager): allow entityManager to work with
 Interceptors

---
 EntityManager/TypeResolver.php | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/EntityManager/TypeResolver.php b/EntityManager/TypeResolver.php
index 1f559c0..b39b83b 100644
--- a/EntityManager/TypeResolver.php
+++ b/EntityManager/TypeResolver.php
@@ -46,6 +46,11 @@ class TypeResolver
     {
         // @todo remove after MAGETWO-52608 resolved
         $className = get_class($type);
+
+        if ($type instanceof \Magento\Framework\Interception\InterceptorInterface) {
+            $className = get_parent_class($type);
+        }
+
         if (isset($this->typeMapping[$className])) {
             return $this->typeMapping[$className];
         }
--
2.31.1