Ejemplo n.º 1
0
 /**
  * @test
  */
 public function preparseQueryHashDiffersForEqualsCaseSensitiveArgument()
 {
     $queryCaseSensitiveFalse = $this->blogRepository->createQuery();
     $queryCaseSensitiveFalse->matching($queryCaseSensitiveFalse->equals('title', 'PoSt1', FALSE));
     list($hashWithCaseSensitiveFalse) = $this->queryParser->preparseQuery($queryCaseSensitiveFalse);
     $queryCaseSensitiveTrue = $this->blogRepository->createQuery();
     $queryCaseSensitiveTrue->matching($queryCaseSensitiveTrue->equals('title', 'PoSt1', TRUE));
     list($hashWithCaseSensitiveTrue) = $this->queryParser->preparseQuery($queryCaseSensitiveTrue);
     $this->assertNotSame($hashWithCaseSensitiveFalse, $hashWithCaseSensitiveTrue);
 }
Ejemplo n.º 2
0
 /**
  * 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);
 }
Ejemplo n.º 3
0
 /**
  * Dump a query.
  *
  * @param  \TYPO3\CMS\Extbase\Persistence\QueryInterface  $query
  * @param  boolean  $return  Whether or not to return dumped query. Echos by default
  * @return  void
  */
 public function query(QueryInterface $query, $return = false)
 {
     DebuggerUtility::var_dump($this->queryParser->parseQuery($query), null, 8, false, true, $return);
 }