Fix missing null check on AbstractQuery#setResultCacheProfile()#6748
Conversation
|
While the failure is trivial, we still need a test case for this |
|
@Ocramius done |
| { | ||
| $query = $this->_em->createQuery('SELECT u FROM ' . CmsUser::class . ' u'); | ||
| $result = $query->setResultCacheProfile(null); | ||
| self::assertEquals($result, $query); |
There was a problem hiding this comment.
I think we should be using $this instead of self:: like the rest of the code base right?
There was a problem hiding this comment.
Shouldn't we assert that the cache profile was NOT configured?
| /** | ||
| * setResultCacheProfile should works correct with null | ||
| */ | ||
| public function testSetResultCacheProfile() |
There was a problem hiding this comment.
| public function testSetResultCacheProfile() | ||
| { | ||
| $query = $this->_em->createQuery('SELECT u FROM ' . CmsUser::class . ' u'); | ||
| $result = $query->setResultCacheProfile(null); |
There was a problem hiding this comment.
This is a bit misleading, $result is not the query result but rather the query
| { | ||
| $query = $this->_em->createQuery('SELECT u FROM ' . CmsUser::class . ' u'); | ||
| $result = $query->setResultCacheProfile(null); | ||
| self::assertEquals($result, $query); |
There was a problem hiding this comment.
Shouldn't we assert that the cache profile was NOT configured?
|
Linking #6861 fixing the same bug, but missing tests. |
To ensure that `AbstractQuery#setResultCacheProfile()` doesn't raise errors when being called with `null`.
AbstractQuery#setResultCacheProfile()
|
@KonstantinKuklin 🚢 and backported via 56ebf4b, thanks for your contribution! |
v2.5.14 This version backports bugfixes related to the generation of queries with joins and configuration of the result set cache profile of a query. Total issues resolved: **2** Bug - [6748: Fix missing null check on `AbstractQuery#setResultCacheProfile()`](doctrine#6748) thanks to @KonstantinKuklin - [6812: Fix syntax error when join unrelated entity with discriminator entity](doctrine#6812) thanks to @Deltachaos
subject