Beispiel #1
0
 public function afterSave($insert, $changedAttributes)
 {
     $this->checkLeagues();
     $this->checkPlayers();
     $this->checkPlayersStat();
     return parent::afterSave($insert, $changedAttributes);
 }
 /**
  * возвращает игроков, относящихся к данному ивенту для фантазии
  * @param int $fantasy_id
  * @return mixed
  */
 public static function loadPlayersListOnFantasy($fantasy_id = 0)
 {
     $event_id = PokerFantasy::getEventId($fantasy_id);
     $eventModel = PokerEvent::findOne($event_id);
     if ($eventModel === null) {
         return;
     }
     $rows = $eventModel->eventPlayersList;
     //echo'<pre>';print_r($rows);echo'</pre>';die;
     return $rows;
 }
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = PokerEvent::find();
     // add conditions that should always apply here
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     // grid filtering conditions
     $query->andFilterWhere(['id' => $this->id, 'start' => $this->start, 'end' => $this->end]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'descr_ru', $this->descr_ru])->andFilterWhere(['like', 'descr_en', $this->descr_en]);
     return $dataProvider;
 }
Beispiel #4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getEvent()
 {
     return $this->hasOne(PokerEvent::className(), ['id' => 'event_id']);
 }