Fetches episodes filtered on the given query.

@param int   $id    The series id.
@param array $query The query parameters to filter episodes on.

@return PaginatedResults The paginated episodes that match the query.
497711
public function getEpisodesWithQuery(int $id, array $query): PaginatedResults
    {
        $json = $this->parent->performAPICallWithJsonResponse(
            'get',
            '/series/'.$id.'/episodes/query',
            ['query' => $query]
        );

        return new PaginatedResults(
            DataParser::parseDataArray($json, BasicEpisode::class),
            $this->parent->getLastLinks()
        );
    }
1228247
private function query($query)
    {
		if(!is_array($query)) {
			return q($query);
		} else {
			foreach($query as $v) {
				q($v);
			}
			return true;
		}
    }
180064
public function filterData(Event $event, Query $query, $id, array &$data) {
        if ($columns = $this->getSchema()->getColumns()) {
            $data = array_intersect_key($data, $columns);
        }

        return true;
    }
251814
public function scopeAgentUserTickets($query, $id)
    {
        return $query->where(function ($subquery) use ($id) {
            $subquery->where('agent_id', $id)->orWhere('user_id', $id);
        });
    }
337128
public function getById(int $id): Series
    {
        /* @var TheTVDbAPILanguageFallback $parent */
        $parent  = $this->parent;
        $closure = $this->getClosureById($id);

        return $parent->getGenerator()->create($closure, Series::class, $this->parent->getAcceptedLanguages(), true);
    }
1021884
public function getImagesQueryParams(int $id): array
    {
        $json = $this->parent->performAPICallWithJsonResponse('get', '/series/'.$id.'/images/query/params');

        return DataParser::parseDataArray($json, ImageQueryParams::class);
    }
1016403
public function getEpisodesByAirdate($ID, $airdate)
	{
		$url = self::APIURL . '/shows/' . $ID . '/episodesbydate?date=' . date('Y-m-d', strtotime($airdate));
		$episodes = $this->getFile($url);

		$allEpisodes = [];
		if (is_array($episodes)) {
			foreach ($episodes as $episode) {
				$ep = new Episode($episode);
				$allEpisodes[] = $ep;
			}
		}
		return $allEpisodes;
	}
1321554
public function getImagesWithQuery(int $id, array $query): array
    {
        /* @var TheTVDbAPILanguageFallback $parent */
        $parent  = $this->parent;
        $closure = $this->getClosureForImagesWithQuery($id, ['query' => $query]);

        return $parent->getGenerator()->create($closure, Image::class, $this->parent->getAcceptedLanguages(), true);
    }
47453
public List<Episode> getAllEpisodes(String id, String language) throws TvDbException {
        List<Episode> episodeList = Collections.emptyList();

        if (isValidNumber(id)) {
            StringBuilder urlBuilder = new StringBuilder();
            urlBuilder.append(BASE_URL)
                      .append(apiKey)
                      .append(SERIES_URL)
                      .append(id)
                      .append(ALL_URL);
            if (StringUtils.isNotBlank(language)) {
                urlBuilder.append(language).append(XML_EXTENSION);
            }

            LOG.trace(URL, urlBuilder.toString());
            episodeList = TvdbParser.getAllEpisodes(urlBuilder.toString(), -1);
        }
        return episodeList;
    }
949283
protected function filterNonSearchableParameters(array $query) {
        $nonSearchableParameterNames = [$this->getQueryModeParameterName()];

        if (property_exists($this, 'withParameterName')) {
            $nonSearchableParameterNames[] = $this->withParameterName;
        }

        if (property_exists($this, 'sortParameterName')) {
            $nonSearchableParameterNames[] = $this->sortParameterName;
        }

        return array_except($query, $nonSearchableParameterNames);
    }
205893
public function count($parentId, array $query = [])
    {
        $resource = $this->createPartialResourceUrlForList($parentId).'/count';

        return $this->client->get($resource, $query)['count'];
    }
255854
public function postFilterQuery($query)
    {
        // @TODO: Is this still right?
        global $pagenow;

        $vars = &$query->query_vars;

        if ($pagenow == 'edit.php' && isset($vars[$this->name]) && is_numeric($vars[$this->name]) && $vars[$this->name]) {
            $term = get_term_by('id', $vars[$this->name], $this->name);

            $vars[$this->name] = $term->slug;
        }

        return $vars;
    }
820065
public function query($query)
    {
        $statement = $this->db->prepare($query);
        $statement->execute($this->binds);

        $this->clear();

        $collection = array();

        while (false !== ($row = $statement->fetchObject())) {
            $collection[] = $this->newDataInstance($row, true);
        }

        return $collection;
    }
979877
public function getEpisodes(int $id, int $page = 1): PaginatedResults
    {
        /* @var TheTVDbAPILanguageFallback $parent */
        $parent  = $this->parent;
        $closure = $this->getClosureForEpisodes($id, ['query' => ['page' => $page]]);

        return new PaginatedResults(
            $parent->getGenerator()->create($closure, BasicEpisode::class, $this->parent->getAcceptedLanguages(), true),
            $this->parent->getLastLinks()
        );
    }
251760
public function paginationEpisodesAction(Request $request, $series)
    {
        $em = $this->getDoctrine()->getManager();
        $dql = "SELECT e FROM ".$this->container->getParameter('oktolab_media.episode_class')." e WHERE e.series = :series ORDER By e.firstranAt DESC";
        $query = $em->createQuery($dql);
        $query->setParameter('series', $series->getId());

        $page = $request->query->get('page', 1);
        $results = $request->query->get('results', 20);

        $paginator  = $this->get('knp_paginator');
        $pagination = $paginator->paginate(
            $query,
            $page/*page number*/,
            $results
        );
        $pagination->setUsedRoute('media_episode_paginator', ['series' => $series]);
        $pagination->setParam('series', $series->getId());

        return ['pagination' => $pagination];
    }
338462
public function findById($id)
    {
        $queryBuilder = $this->createQueryBuilder('a')
            ->addSelect('domains')
            ->leftJoin('a.domains', 'domains')
            ->where('a.id = :id');

        $query = $queryBuilder->getQuery();
        $query->setParameter('id', $id);

        return $query->getSingleResult();
    }
1148993
public function selectById($id, Query $query = null, $join = 'all')
        {
            if (!$this->hasCachedB2DBObject($id)) {
                $row = $this->rawSelectById($id, $query, $join);
                $object = $this->populateFromRow($row);
            } else {
                $object = $this->getB2DBCachedObject($id);
            }
            return $object;
        }