/** * Looks for the query in cache or builds it up otherwise * * @param QueryInterface $query * @param bool $resolveParameterPlaceholders whether to resolve the parameters or leave the placeholders * @return array * @throws \RuntimeException */ protected function getStatementParts($query, $resolveParameterPlaceholders = TRUE) { /** * The queryParser will preparse the query to get the query's hash and parameters. * If the hash is found in the cache and useQueryCaching is enabled, extbase will * then take the string representation from cache and build a prepared query with * the parameters found. * * Otherwise extbase will parse the complete query, build the string representation * and run a usual query. */ list($queryHash, $parameters) = $this->queryParser->preparseQuery($query); if ($query->getQuerySettings()->getUseQueryCache()) { $statementParts = $this->getQueryCacheEntry($queryHash); if ($queryHash && !$statementParts) { $statementParts = $this->queryParser->parseQuery($query); $this->setQueryCacheEntry($queryHash, $statementParts); } } else { $statementParts = $this->queryParser->parseQuery($query); } if (!$statementParts) { throw new \RuntimeException('Your query could not be built.', 1394453197); } $this->queryParser->addDynamicQueryParts($query->getQuerySettings(), $statementParts); // Limit and offset are not cached to allow caching of pagebrowser queries. $statementParts['limit'] = (int) $query->getLimit() ?: NULL; $statementParts['offset'] = (int) $query->getOffset() ?: NULL; if ($resolveParameterPlaceholders === TRUE) { $statementParts = $this->resolveParameterPlaceholders($statementParts, $parameters); } return array($statementParts, $parameters); }