protected function linkEvents($src_type) { $time = StatTime::create(__METHOD__); $events = Event::model()->with(['team_home_convert', 'team_away_convert'])->findAllByAttributes(['event_id' => null, 'src_type' => $src_type]); foreach ($events as $event) { /* @var $event Event */ $cevent = Event::model()->find(array_and(['src_type = :src_type', 'date = :date', 'team_home = :team_home', 'team_away = :team_away']), ['src_type' => Event::SRCTYPE_COMBINE, 'date' => $event->date, 'team_home' => $event->teamHomeConverted, 'team_away' => $event->teamAwayConverted]); if ($cevent) { $event->event_id = $cevent->id; $event->save(); } } $time->saveTime(); }
private function actionList($src_type, $page = 1, $limit = 10, $q = '') { $teams = explode(' - ', $q); $team1 = isset($teams[0]) ? $teams[0] : null; $team2 = isset($teams[1]) ? $teams[1] : null; $list = $this->createPaginatorList(Event::model(), ['condition' => array_and(['t.src_type = :src_type', array_or([$team1 ? '(t.team_home like :team1 or t.team_away like :team1)' : null, $team2 ? '(t.team_home like :team2 or t.team_away like :team2)' : null])]), 'params' => array_filter(['src_type' => $src_type, 'team1' => $team1 ? "%{$team1}%" : null, 'team2' => $team2 ? "%{$team2}%" : null]), 'order' => 't.date', 'limit' => $limit], $page); $this->render('list', ['src_type' => $src_type, 'list' => $list, 'q' => $q]); }