]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
Добавление миграции и модели
authorfomichev <vladimir.fomichev@erp-flowers.ru>
Wed, 4 Jun 2025 14:22:26 +0000 (17:22 +0300)
committerfomichev <vladimir.fomichev@erp-flowers.ru>
Wed, 4 Jun 2025 14:22:26 +0000 (17:22 +0300)
erp24/migrations/m250604_141110_create_marketplace_order_1c_statuses_relations_table.php [new file with mode: 0644]
erp24/records/MarketplaceOrder1cStatusesRelations.php [new file with mode: 0644]

diff --git a/erp24/migrations/m250604_141110_create_marketplace_order_1c_statuses_relations_table.php b/erp24/migrations/m250604_141110_create_marketplace_order_1c_statuses_relations_table.php
new file mode 100644 (file)
index 0000000..8833354
--- /dev/null
@@ -0,0 +1,43 @@
+<?php
+
+use yii\db\Migration;
+
+/**
+ * Handles the creation of table `{{%marketplace_order_1c_statuses_relations}}`.
+ */
+class m250604_141110_create_marketplace_order_1c_statuses_relations_table extends Migration
+{
+    const TABLE_NAME = 'erp24.marketplace_order_1c_statuses_relations';
+    /**
+     * {@inheritdoc}
+     */
+    public function safeUp()
+    {
+        $tableSchema = $this->db->getTableSchema(self::TABLE_NAME);
+
+        if (!isset($tableSchema)) {
+            $this->createTable(self::TABLE_NAME, [
+                'id' => $this->primaryKey(),
+
+                'status_id_from' => $this->integer()->comment('Cтатус текущий - ссылка на id из таблицы marketplace_order_1c_statuses'),
+                'status_id_to' => $this->integer()->comment('Cтатус для перехода - ссылка на id из таблицы marketplace_order_1c_statuses'),
+                'description' => $this->text()->null()->comment('Описание для 1С'),
+                'button_text' => $this->string()->null()->comment('Текст кнопки'),
+                'created_at' => $this->dateTime()->comment('Дата создания'),
+                'updated_at' => $this->dateTime()->comment('Дата обновления'),
+
+            ]);
+        }
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function safeDown()
+    {
+        $tableSchema = $this->db->getTableSchema(self::TABLE_NAME);
+        if (isset($tableSchema)) {
+            $this->dropTable(self::TABLE_NAME);
+        }
+    }
+}
diff --git a/erp24/records/MarketplaceOrder1cStatusesRelations.php b/erp24/records/MarketplaceOrder1cStatusesRelations.php
new file mode 100644 (file)
index 0000000..c035c6e
--- /dev/null
@@ -0,0 +1,61 @@
+<?php
+
+namespace yii_app\records;
+
+use Yii;
+
+/**
+ * This is the model class for table "marketplace_order_1c_statuses_relations".
+ *
+ * @property int $id
+ * @property int|null $status_id_from Cтатус текущий - ссылка на id из таблицы marketplace_order_1c_statuses
+ * @property int|null $status_id_to Cтатус для перехода - ссылка на id из таблицы marketplace_order_1c_statuses
+ * @property string|null $description Описание для 1С
+ * @property string|null $button_text Текст кнопки
+ * @property string|null $created_at Дата создания
+ * @property string|null $updated_at Дата обновления
+ */
+class MarketplaceOrder1cStatusesRelations extends \yii\db\ActiveRecord
+{
+
+
+    /**
+     * {@inheritdoc}
+     */
+    public static function tableName()
+    {
+        return 'marketplace_order_1c_statuses_relations';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function rules()
+    {
+        return [
+            [['status_id_from', 'status_id_to', 'description', 'button_text', 'created_at', 'updated_at'], 'default', 'value' => null],
+            [['status_id_from', 'status_id_to'], 'default', 'value' => null],
+            [['status_id_from', 'status_id_to'], 'integer'],
+            [['description'], 'string'],
+            [['created_at', 'updated_at'], 'safe'],
+            [['button_text'], 'string', 'max' => 255],
+        ];
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function attributeLabels()
+    {
+        return [
+            'id' => 'ID',
+            'status_id_from' => 'Status Id From',
+            'status_id_to' => 'Status Id To',
+            'description' => 'Description',
+            'button_text' => 'Button Text',
+            'created_at' => 'Created At',
+            'updated_at' => 'Updated At',
+        ];
+    }
+
+}