@@ -942,6 +942,7 @@ public function updateAttribute($entityTypeId, $id, $field, $value = null, $sort
942
942
* @param mixed $value
943
943
* @param int $sortOrder
944
944
* @return $this
945
+ * @throws LocalizedException
945
946
*/
946
947
private function _updateAttribute ($ entityTypeId , $ id , $ field , $ value = null , $ sortOrder = null )
947
948
{
@@ -972,11 +973,15 @@ private function _updateAttribute($entityTypeId, $id, $field, $value = null, $so
972
973
return $ this ;
973
974
}
974
975
}
976
+ $ attributeId = $ this ->getAttributeId ($ entityTypeId , $ id );
977
+ if (false === $ attributeId ) {
978
+ throw new LocalizedException (__ ('Attribute with ID: "%1" does not exist ' , $ id ));
979
+ }
975
980
976
981
$ this ->setup ->updateTableRow (
977
982
'eav_attribute ' ,
978
983
'attribute_id ' ,
979
- $ this -> getAttributeId ( $ entityTypeId , $ id ) ,
984
+ $ attributeId ,
980
985
$ field ,
981
986
$ value ,
982
987
'entity_type_id ' ,
@@ -994,6 +999,7 @@ private function _updateAttribute($entityTypeId, $id, $field, $value = null, $so
994
999
* @param string|array $field
995
1000
* @param mixed $value
996
1001
* @return $this
1002
+ * @throws LocalizedException
997
1003
*/
998
1004
private function _updateAttributeAdditionalData ($ entityTypeId , $ id , $ field , $ value = null )
999
1005
{
@@ -1022,6 +1028,11 @@ private function _updateAttributeAdditionalData($entityTypeId, $id, $field, $val
1022
1028
return $ this ;
1023
1029
}
1024
1030
}
1031
+
1032
+ $ attributeId = $ this ->getAttributeId ($ entityTypeId , $ id );
1033
+ if (false === $ attributeId ) {
1034
+ throw new LocalizedException (__ ('Attribute with ID: "%1" does not exist ' , $ id ));
1035
+ }
1025
1036
$ this ->setup ->updateTableRow (
1026
1037
$ this ->setup ->getTable ($ additionalTable ),
1027
1038
'attribute_id ' ,
0 commit comments