|
- <?php
-
- namespace common\logic\Order\OrderStatusHistory\Model;
-
- use common\components\ActiveRecordCommon;
- use common\logic\Order\Order\Model\Order;
- use common\logic\User\User\Model\User;
-
- /**
- * This is the model class for table "order_status_history".
- */
- class OrderStatusHistory extends ActiveRecordCommon
- {
- /**
- * @inheritdoc
- */
- public static function tableName()
- {
- return 'order_status_history';
- }
-
- /**
- * @inheritdoc
- */
- public function rules()
- {
- return [
- [['id_order', 'status', 'id_user', 'date', 'origin'], 'required'],
- [['id_order', 'id_user',], 'integer'],
- [['date'], 'safe'],
- ];
- }
-
- /**
- * @inheritdoc
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'id_order' => 'Commande',
- 'id_user' => 'Utilisateur',
- 'status' => 'Statut',
- 'origin' => 'Origine',
- 'date' => 'Date',
- ];
- }
-
- /*
- * Relations
- */
-
- public function getOrder()
- {
- return $this->hasOne(Order::class, ['id' => 'id_order']);
- }
-
- public function populateOrder(Order $order): void
- {
- $this->populateFieldObject('id_order', 'order', $order);
- }
-
- public function getUser()
- {
- return $this->hasOne(User::class, ['id' => 'id_user']);
- }
-
- public function populateUser(User $user): void
- {
- $this->populateFieldObject('id_user', 'user', $user);
- }
- }
|