100], [['title', 'cover'], 'string', 'max' => 200] ]; } /** * @inheritdoc */ public function attributeLabels() { return [ 'id' => 'ID', 'orderId' => 'Order ID', 'goodsId' => 'Goods ID', 'userId' => 'User ID', 'merchantId' => 'Merchant ID', 'title' => 'Title', 'cover' => 'Cover', 'unitPrice' => 'Unit Price', 'num' => 'Num', 'multiPriceId' => 'Multi Price Id', 'createTime' => 'Create Time', 'updateTime' => 'Update Time', ]; } public function getXhGoods() { // 关系和商品通过 Goods.id -> goodsId 关联建立一对一关系 return $this->hasOne(xhGoods::className(), ['id' => 'goodsId']); } }