File tree Expand file tree Collapse file tree 2 files changed +32
-1
lines changed
lib/internal/Magento/Framework/EntityManager Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -106,4 +106,15 @@ public function getHydrator($entityType)
106
106
$ objectManager = \Magento \Framework \App \ObjectManager::getInstance ();
107
107
return $ objectManager ->get (HydratorPool::class)->getHydrator ($ entityType );
108
108
}
109
+
110
+ /**
111
+ * Check if entity type configuration was set to metadata
112
+ *
113
+ * @param string $entityType
114
+ * @return bool
115
+ */
116
+ public function hasConfiguration ($ entityType )
117
+ {
118
+ return isset ($ this ->metadata [$ entityType ]);
119
+ }
109
120
}
Original file line number Diff line number Diff line change 10
10
*/
11
11
class TypeResolver
12
12
{
13
+ /**
14
+ * @var MetadataPool
15
+ */
16
+ private $ metadataPool ;
17
+
18
+ /**
19
+ * TypeResolver constructor.
20
+ * @param MetadataPool $metadataPool
21
+ */
22
+ public function __construct (MetadataPool $ metadataPool )
23
+ {
24
+ $ this ->metadataPool = $ metadataPool ;
25
+ }
26
+
13
27
/**
14
28
* @var array
15
29
*/
@@ -45,6 +59,12 @@ public function resolve($type)
45
59
throw new \Exception ('Unable to determine data interface for ' . $ className );
46
60
}
47
61
48
- return reset ($ dataInterfaces );
62
+ foreach ($ dataInterfaces as $ dataInterface ) {
63
+ if ($ this ->metadataPool ->hasConfiguration ($ dataInterface )) {
64
+ break ;
65
+ }
66
+ }
67
+
68
+ return $ dataInterface ;
49
69
}
50
70
}
You can’t perform that action at this time.
0 commit comments