From a2da9c1a448a1b1cfb9b428612a4a634d668c6b7 Mon Sep 17 00:00:00 2001 From: Vladyslav Shcherbyna <vshcherbyna@ebay.com> Date: Wed, 1 Jul 2015 16:21:56 +0300 Subject: [PATCH] MAGETWO-38779: Stabilize story --- .../Magento/Eav/Model/Entity/VersionControl/Metadata.php | 7 ++++--- .../Model/Resource/Db/VersionControl/Metadata.php | 7 ++++--- .../Model/Resource/Db/VersionControl/Snapshot.php | 5 +++-- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/app/code/Magento/Eav/Model/Entity/VersionControl/Metadata.php b/app/code/Magento/Eav/Model/Entity/VersionControl/Metadata.php index 21078e881b4..c628f450b7a 100644 --- a/app/code/Magento/Eav/Model/Entity/VersionControl/Metadata.php +++ b/app/code/Magento/Eav/Model/Entity/VersionControl/Metadata.php @@ -18,7 +18,8 @@ class Metadata extends \Magento\Framework\Model\Resource\Db\VersionControl\Metad */ 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( $entity->getResource()->getEntityTable() ); @@ -30,9 +31,9 @@ class Metadata extends \Magento\Framework\Model\Resource\Db\VersionControl\Metad null ); - $this->metadataInfo[get_class($entity)] = $fields; + $this->metadataInfo[$entityClass] = $fields; } - return $this->metadataInfo[get_class($entity)]; + return $this->metadataInfo[$entityClass]; } } diff --git a/lib/internal/Magento/Framework/Model/Resource/Db/VersionControl/Metadata.php b/lib/internal/Magento/Framework/Model/Resource/Db/VersionControl/Metadata.php index 3870ca75f45..b761d22717f 100644 --- a/lib/internal/Magento/Framework/Model/Resource/Db/VersionControl/Metadata.php +++ b/lib/internal/Magento/Framework/Model/Resource/Db/VersionControl/Metadata.php @@ -24,8 +24,9 @@ class Metadata */ public function getFields(\Magento\Framework\Object $entity) { - if (!isset($this->metadataInfo[get_class($entity)])) { - $this->metadataInfo[get_class($entity)] = + $entityClass = get_class($entity); + if (!isset($this->metadataInfo[$entityClass])) { + $this->metadataInfo[$entityClass] = array_fill_keys( array_keys( $entity->getResource()->getReadConnection()->describeTable( @@ -35,6 +36,6 @@ class Metadata null ); } - return $this->metadataInfo[get_class($entity)]; + return $this->metadataInfo[$entityClass]; } } diff --git a/lib/internal/Magento/Framework/Model/Resource/Db/VersionControl/Snapshot.php b/lib/internal/Magento/Framework/Model/Resource/Db/VersionControl/Snapshot.php index 113c468672a..dc837426020 100644 --- a/lib/internal/Magento/Framework/Model/Resource/Db/VersionControl/Snapshot.php +++ b/lib/internal/Magento/Framework/Model/Resource/Db/VersionControl/Snapshot.php @@ -60,10 +60,11 @@ class Snapshot return true; } - if (!isset($this->snapshotData[get_class($entity)][$entity->getId()])) { + $entityClass = get_class($entity); + if (!isset($this->snapshotData[$entityClass][$entity->getId()])) { 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) { return true; } -- GitLab