public function notAssignedAuctions(){ $query = Lots::find()->joinWith([ 'auction0' ])->where([ 'auctions.status' => 0 ]); return new ActiveDataProvider([ 'query' => $query, 'pagination' => [ 'pageSize' => 2 ] ]); }
public function getLot0(){ return $this->hasOne(Lots::className(),['id' => 'lot_id']); }
/** * Finds the Lots model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Lots the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Lots::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * @return \yii\db\ActiveQuery */ public function getLots($id) { return new ActiveDataProvider([ 'query' => Lots::find() ->innerJoinWith([ 'lotPreferences' => function($query){ $query->joinWith(['category0' , 'brand0'])->asArray(); }, ])->where(['lots.auction' => $id]) ]); }