InventoryOrder.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. /**
  3. * InventoryOrder.php
  4. * todo 文件描述
  5. * Created on 2024/3/26 10:25
  6. * @author: hankaige
  7. */
  8. namespace app\models;
  9. use yii\behaviors\TimestampBehavior;
  10. use yii\db\ActiveRecord;
  11. /**
  12. * This is the model class for table "{{%inventory_list}}".
  13. * @property integer $id
  14. * @property integer $inventory_id
  15. * @property integer $order_id
  16. * @property integer $is_delete
  17. * @property integer $created_at
  18. */
  19. class InventoryOrder extends \yii\db\ActiveRecord
  20. {
  21. public static function tableName()
  22. {
  23. return "{{%inventory_order}}";
  24. }
  25. public function behaviors()
  26. {
  27. return [
  28. [
  29. 'class' => TimestampBehavior::class,
  30. 'attributes' => [
  31. ActiveRecord::EVENT_BEFORE_INSERT => ['created_at'],
  32. ActiveRecord::EVENT_BEFORE_UPDATE => ['updated_at']
  33. ]
  34. ]
  35. ];
  36. }
  37. public function rules()
  38. {
  39. return [
  40. [['inventory_id','order_id'],'integer'],
  41. [['inventory_id','order_id'],'required'],
  42. ];
  43. }
  44. public function attributeLabels()
  45. {
  46. return [
  47. 'inventory_id'=>'备货单ID','order_id'=>'订单ID'
  48. ];
  49. }
  50. public function getOrder()
  51. {
  52. return $this->hasOne(Order::tableName(),['id'=>'order_id']);
  53. }
  54. }