if (!empty($oldFile)) {
$oldFile->delete();
}
- $modelEdit->save();
+ if (!$modelEdit->save()){
+ Yii::error("Ошибка созранения ссылок на картинки " . json_encode($modelEdit->getErrors(), JSON_UNESCAPED_UNICODE));
+ }
}
}
}
+ if ($modelEdit->image_id) {
+ $modelEdit->external_image_url = MarketplaceService::getProductImageUrl($modelEdit->image_id);
+ }
+
}
return $this->redirect(['matrix-erp/view', 'id' => $matrixErpId]);
--- /dev/null
+<?php
+
+use yii\db\Migration;
+
+class m250811_135208_increase_columns_length_to_255_in_matrix_erp_property extends Migration
+{
+ const TABLE_NAME = 'erp24.matrix_erp_property';
+
+ /** @inheritDoc */
+ public function safeUp()
+ {
+ $columns = [
+ 'external_image_url',
+ 'product_url',
+ ];
+
+ foreach ($columns as $col) {
+ $this->alterColumn(self::TABLE_NAME, $col, $this->string(255)->null());
+ }
+ }
+
+ /** @inheritDoc */
+ public function safeDown()
+ {
+ $columns = [
+ 'external_image_url',
+ 'product_url',
+ ];
+
+ foreach ($columns as $col) {
+ $this->alterColumn(self::TABLE_NAME, $col, $this->string(100)->null());
+ }
+ }
+}
\ No newline at end of file
'file', 'skipOnEmpty' => true, 'extensions' => 'png, jpg', 'checkExtensionByMimeType' => false
],
[['mediaFile', 'id', 'display_name', 'external_image_url', 'product_url', 'flowwow_category', 'flowwow_subcategory',], 'safe'],
- [['guid', 'date', 'created_at', 'updated_at', 'display_name', 'external_image_url', 'product_url', 'flowwow_category', 'flowwow_subcategory'], 'string', 'max' => 100],
- [['url_link_video'], 'string', 'max' => 255],
+ [['guid', 'date', 'created_at', 'updated_at', 'display_name', 'flowwow_category', 'flowwow_subcategory'], 'string', 'max' => 100],
+ [['url_link_video', 'external_image_url', 'product_url'], 'string', 'max' => 255],
];
}