Skip to content
Snippets Groups Projects
Commit a2da9c1a authored by Vladyslav Shcherbyna's avatar Vladyslav Shcherbyna
Browse files

MAGETWO-38779: Stabilize story

parent 21ecf3b9
No related merge requests found
...@@ -18,7 +18,8 @@ class Metadata extends \Magento\Framework\Model\Resource\Db\VersionControl\Metad ...@@ -18,7 +18,8 @@ class Metadata extends \Magento\Framework\Model\Resource\Db\VersionControl\Metad
*/ */
public function getFields(\Magento\Framework\Object $entity) public function getFields(\Magento\Framework\Object $entity)
{ {
if (!isset($this->metadataInfo[get_class($entity)])) { $entityClass = get_class($entity);
if (!isset($this->metadataInfo[$entityClass])) {
$fields = $entity->getResource()->getReadConnection()->describeTable( $fields = $entity->getResource()->getReadConnection()->describeTable(
$entity->getResource()->getEntityTable() $entity->getResource()->getEntityTable()
); );
...@@ -30,9 +31,9 @@ class Metadata extends \Magento\Framework\Model\Resource\Db\VersionControl\Metad ...@@ -30,9 +31,9 @@ class Metadata extends \Magento\Framework\Model\Resource\Db\VersionControl\Metad
null null
); );
$this->metadataInfo[get_class($entity)] = $fields; $this->metadataInfo[$entityClass] = $fields;
} }
return $this->metadataInfo[get_class($entity)]; return $this->metadataInfo[$entityClass];
} }
} }
...@@ -24,8 +24,9 @@ class Metadata ...@@ -24,8 +24,9 @@ class Metadata
*/ */
public function getFields(\Magento\Framework\Object $entity) public function getFields(\Magento\Framework\Object $entity)
{ {
if (!isset($this->metadataInfo[get_class($entity)])) { $entityClass = get_class($entity);
$this->metadataInfo[get_class($entity)] = if (!isset($this->metadataInfo[$entityClass])) {
$this->metadataInfo[$entityClass] =
array_fill_keys( array_fill_keys(
array_keys( array_keys(
$entity->getResource()->getReadConnection()->describeTable( $entity->getResource()->getReadConnection()->describeTable(
...@@ -35,6 +36,6 @@ class Metadata ...@@ -35,6 +36,6 @@ class Metadata
null null
); );
} }
return $this->metadataInfo[get_class($entity)]; return $this->metadataInfo[$entityClass];
} }
} }
...@@ -60,10 +60,11 @@ class Snapshot ...@@ -60,10 +60,11 @@ class Snapshot
return true; return true;
} }
if (!isset($this->snapshotData[get_class($entity)][$entity->getId()])) { $entityClass = get_class($entity);
if (!isset($this->snapshotData[$entityClass][$entity->getId()])) {
return true; return true;
} }
foreach ($this->snapshotData[get_class($entity)][$entity->getId()] as $field => $value) { foreach ($this->snapshotData[$entityClass][$entity->getId()] as $field => $value) {
if ($entity->getDataByKey($field) != $value) { if ($entity->getDataByKey($field) != $value) {
return true; return true;
} }
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment