Exemplo n.º 1
0
    public function notAssignedAuctions(){
        $query = Lots::find()->joinWith([
            'auction0'
        ])->where([
            'auctions.status' => 0
        ]);

        return new ActiveDataProvider([
            'query' => $query,
            'pagination' => [
                'pageSize' => 2
            ]
        ]);
    }
Exemplo n.º 2
0
    /**
     * Updates an existing Lots model.
     * If update is successful, the browser will be redirected to the 'view' page.
     * @param integer $id
     * @return mixed
     */
    public function actionUpdate()
    {
        $id = Auction::$app->request->post('id');

        if($id){
            $model = Lots::find()->joinWith(['lotPreferences'])->where('lots.id=:id',[':id' => $id])->one();

            if (isset($_POST['Lots'])) {
                $model->load(Yii::$app->request->post());
                $model->lotPreferences->load(Yii::$app->request->post());

                if($model->update())
                    return 'Success';
            } else {
                return $this->renderPartial('_form', [
                    'model' => $model,
                ]);
            }
        }
    }
Exemplo n.º 3
0
    /**
     * @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])
        ]);

    }