Skip to content

Commit

Permalink
[GH-7633] HINT_FORCE_PARTIAL_LOAD still needs to be checked.
Browse files Browse the repository at this point in the history
  • Loading branch information
beberlei committed Mar 1, 2020
1 parent 57d64bf commit c4a8d2c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/Doctrine/ORM/Cache/DefaultQueryCache.php
Expand Up @@ -260,7 +260,7 @@ public function put(QueryCacheKey $key, ResultSetMapping $rsm, $result, array $h
throw new CacheException("Second-level cache query supports only select statements.");
}

if (isset($hints[Query\SqlWalker::HINT_PARTIAL]) && $hints[Query\SqlWalker::HINT_PARTIAL]) {
if (($hints[Query\SqlWalker::HINT_PARTIAL] ?? false) === true || ($hints[Query::HINT_FORCE_PARTIAL_LOAD] ?? false) === true) {
throw new CacheException("Second level cache does not support partial entities.");
}

Expand Down
Expand Up @@ -1099,6 +1099,21 @@ public function testCacheablePartialQueryException()
->getResult();
}

/**
* @expectedException \Doctrine\ORM\Cache\CacheException
* @expectedExceptionMessage Second level cache does not support partial entities.
*/
public function testCacheableForcePartialLoadHintQueryException()
{
$this->evictRegions();
$this->loadFixturesCountries();

$this->_em->createQuery("SELECT c FROM Doctrine\Tests\Models\Cache\Country c")
->setCacheable(true)
->setHint(Query::HINT_FORCE_PARTIAL_LOAD, true)
->getResult();
}

/**
* @expectedException \Doctrine\ORM\Cache\CacheException
* @expectedExceptionMessage Second-level cache query supports only select statements.
Expand Down

0 comments on commit c4a8d2c

Please sign in to comment.