Skip to content

Commit ef3515c

Browse files
committed
MAGETWO-52105: Edit category does not work
1 parent 08eebe4 commit ef3515c

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

lib/internal/Magento/Framework/EntityManager/MetadataPool.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,4 +106,15 @@ public function getHydrator($entityType)
106106
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
107107
return $objectManager->get(HydratorPool::class)->getHydrator($entityType);
108108
}
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+
}
109120
}

lib/internal/Magento/Framework/EntityManager/TypeResolver.php

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,20 @@
1010
*/
1111
class TypeResolver
1212
{
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+
1327
/**
1428
* @var array
1529
*/
@@ -45,6 +59,12 @@ public function resolve($type)
4559
throw new \Exception('Unable to determine data interface for ' . $className);
4660
}
4761

48-
return reset($dataInterfaces);
62+
foreach ($dataInterfaces as $dataInterface) {
63+
if ($this->metadataPool->hasConfiguration($dataInterface)) {
64+
break;
65+
}
66+
}
67+
68+
return $dataInterface;
4969
}
5070
}

0 commit comments

Comments
 (0)