yii2 with 问题
資深大佬 : fangwenxue 74
UserHistory
self::find()->with('book.lastItem')->where("uid = {$uid}")->orderBy('id desc')->asArray()->all(); public function getBook() { return $this->hasOne(Book::class, ['id' => 'book_id']); }
Book
public function getLatItem(){ return $this->hasOne(BookItem::class, ['book_id' => 'id'])->orderBy('id desc'); }
-
appmodelsBook has no relation named “lastItem”.
-
with 不支持我这种写法还是?
大佬有話說 (4)