private function needUpdateSplatfest()
 {
     // データが何もなければ取得が必要
     $count = SplatfestMap::find()->innerJoinWith(['splatfest', 'splatfest.region'])->andWhere(['{{region}}.[[key]]' => 'jp'])->count();
     if ($count < 1) {
         return true;
     }
     // 今がフェス中でなければ不要
     $now = gmdate('Y-m-d\\TH:i:sP', (int) (@$_SERVER['REQUEST_TIME'] ?: time()));
     $fest = Splatfest::find()->innerJoinWith('region', false)->andWhere(['and', ['{{region}}.[[key]]' => 'jp'], ['<=', '{{splatfest}}.[[start_at]]', $now], ['>', '{{splatfest}}.[[end_at]]', $now]])->one();
     if (!$fest) {
         return false;
     }
     // マップ情報をもっていれば不要
     $count = SplatfestMap::find()->andWhere(['{{splatfest_map}}.[[splatfest_id]]' => $fest->id])->count();
     return $count < 1;
 }
Example #2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getSplatfestMaps()
 {
     return $this->hasMany(SplatfestMap::className(), ['splatfest_id' => 'id']);
 }