private function _getMatchesIdsFromMatches()
    {
        $_matchesIdsFromSlots = $this->_getMatchesIdsFromSlots();
        $db = Db::obtain();
        // basic matches data
        $matchesQuery = 'SELECT * FROM ' . Db::realTablename('matches') . '';
        $where = '';
        $data = array();

        if (null !== $this->getLeagueId()) {
            $where .= 'leagueid = ? AND ';
            array_push($data, $this->getLeagueId());
        }

        if (null !== $this->getTeamId()) {
            $where .= '(radiant_team_id = ? OR dire_team_id = ?) AND ';
            array_push($data, $this->getTeamId());
            array_push($data, $this->getTeamId());
        }

        if (count($_matchesIdsFromSlots)) {
            $where .= 'match_id IN (' . implode(',', $_matchesIdsFromSlots) . ') AND ';
        }

        if (null !== $this->getStartAtMatchId()) {
            $where .= 'match_id > ? AND ';
            array_push($data, $this->getStartAtMatchId());
        }

        if (trim($where) !== '') {
            $matchesQuery .= ' WHERE ' . substr($where, 0, strlen($where) - 4);
        }

        $matchesQuery .= ' ORDER BY start_time DESC';

        if (null !== $this->getMatchesRequested()) {
            $matchesQuery .= ' LIMIT ?';
            array_push($data, $this->getMatchesRequested());
        }

        $matchesInfo = $db->fetchArrayPDO($matchesQuery, $data);
        // no one match found
        if (count($matchesInfo) === 0) {
            return array();
        }
        return $matchesInfo;
    }
private function _getMatchesIdsFromMatches()
    {
        $_matchesIdsFromSlots = $this->_getMatchesIdsFromSlots();
        $db = Db::obtain();
        // basic matches data
        $matchesQuery = 'SELECT * FROM ' . Db::realTablename('matches') . '';
        $where = '';
        $data = array();

        if (null !== $this->getLeagueId()) {
            $where .= 'leagueid = ? AND ';
            array_push($data, $this->getLeagueId());
        }

        if (null !== $this->getTeamId()) {
            $where .= '(radiant_team_id = ? OR dire_team_id = ?) AND ';
            array_push($data, $this->getTeamId());
            array_push($data, $this->getTeamId());
        }

        if (count($_matchesIdsFromSlots)) {
            $where .= 'match_id IN (' . implode(',', $_matchesIdsFromSlots) . ') AND ';
        }

        if (null !== $this->getStartAtMatchId()) {
            $where .= 'match_id > ? AND ';
            array_push($data, $this->getStartAtMatchId());
        }

        if (trim($where) !== '') {
            $matchesQuery .= ' WHERE ' . substr($where, 0, strlen($where) - 4);
        }

        $matchesQuery .= ' ORDER BY start_time DESC';

        if (null !== $this->getMatchesRequested()) {
            $matchesQuery .= ' LIMIT ?';
            array_push($data, $this->getMatchesRequested());
        }

        $matchesInfo = $db->fetchArrayPDO($matchesQuery, $data);
        // no one match found
        if (count($matchesInfo) === 0) {
            return array();
        }
        return $matchesInfo;
    }
private function _getMatchesIdsFromMatches ( ) { $ _matchesIdsFromSlots = $ this -> _getMatchesIdsFromSlots ( ) ; $ db = Db :: obtain ( ) ; // basic matches data $ matchesQuery = 'SELECT * FROM ' . Db :: realTablename ( 'matches' ) . '' ; $ where = '' ; $ data = array ( ) ; if ( null !== $ this -> getLeagueId ( ) ) { $ where .= 'leagueid = ? AND ' ; array_push ( $ data , $ this -> getLeagueId ( ) ) ; } if ( null !== $ this -> getTeamId ( ) ) { $ where .= '(radiant_team_id = ? OR dire_team_id = ?) AND ' ; array_push ( $ data , $ this -> getTeamId ( ) ) ; array_push ( $ data , $ this -> getTeamId ( ) ) ; } if ( count ( $ _matchesIdsFromSlots ) ) { $ where .= 'match_id IN (' . implode ( ',' , $ _matchesIdsFromSlots ) . ') AND ' ; } if ( null !== $ this -> getStartAtMatchId ( ) ) { $ where .= 'match_id > ? AND ' ; array_push ( $ data , $ this -> getStartAtMatchId ( ) ) ; } if ( trim ( $ where ) !== '' ) { $ matchesQuery .= ' WHERE ' . substr ( $ where , 0 , strlen ( $ where ) - 4 ) ; } $ matchesQuery .= ' ORDER BY start_time DESC' ; if ( null !== $ this -> getMatchesRequested ( ) ) { $ matchesQuery .= ' LIMIT ?' ; array_push ( $ data , $ this -> getMatchesRequested ( ) ) ; } $ matchesInfo = $ db -> fetchArrayPDO ( $ matchesQuery , $ data ) ; // no one match found if ( count ( $ matchesInfo ) === 0 ) { return array ( ) ; } return $ matchesInfo ; }
Get info about matches from the "matches" table
Use matches ids from slots table as additional filter
@return array
Get info about matches from the matches table Use matches ids from slots table as additional filter