Skip to content

Commit

Permalink
Do not save if no changes (#26)
Browse files Browse the repository at this point in the history
* Do not save if no changes

* Edit field length
  • Loading branch information
VincentBean authored Jan 18, 2023
1 parent f5029c1 commit a50f37f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions Job/ImportMetricUnits.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ public function execute(OutputInterface $output = null): void
continue;
}

if ($magentoAttribute->getData(self::EAV_ATTRIBUTE_UNIT_FIELD) == $unit) {
continue;
}

$magentoAttribute->setData(self::EAV_ATTRIBUTE_UNIT_FIELD, $unit);
$magentoAttribute->save();

Expand Down
2 changes: 1 addition & 1 deletion etc/db_schema.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
<table name="eav_attribute" resource="default" engine="innodb">
<column xsi:type="varchar" name="unit" length="20" nullable="true"
<column xsi:type="varchar" name="unit" length="255" nullable="true"
comment="Akeneo metric unit"/>
</table>
</schema>

0 comments on commit a50f37f

Please sign in to comment.