From 4cc038b5b01177e037e7c907c506a0d80331d224 Mon Sep 17 00:00:00 2001 From: Romain Ruaud Date: Mon, 12 Feb 2018 11:51:16 +0100 Subject: [PATCH] Ensure renaming the attribute only if needed. --- Setup/RatingSetup.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Setup/RatingSetup.php b/Setup/RatingSetup.php index 2d0007f..384cdb0 100644 --- a/Setup/RatingSetup.php +++ b/Setup/RatingSetup.php @@ -85,6 +85,8 @@ public function createRatingAttributes($eavSetup) public function renameRatingAttribute($eavSetup) { $entity = ProductAttributeInterface::ENTITY_TYPE_CODE; - $eavSetup->updateAttribute($entity, 'rating_summary', ['attribute_code' => 'ratings_summary']); + if ($eavSetup->getAttributeId($entity, 'rating_summary') !== false) { + $eavSetup->updateAttribute($entity, 'rating_summary', ['attribute_code' => 'ratings_summary']); + } } }