Skip to content

Commit

Permalink
Ensure renaming the attribute only if needed.
Browse files Browse the repository at this point in the history
  • Loading branch information
romainruaud committed Feb 12, 2018
1 parent f585de7 commit 4cc038b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Setup/RatingSetup.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
}
}
}

0 comments on commit 4cc038b

Please sign in to comment.