Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
5a96217d
Commit
5a96217d
authored
Feb 13, 2010
by
beberlei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[2.0] DDC-328 - Query and Result Cache Keys now depend on the hydrationMode also
parent
8b2ca0d4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
2 deletions
+32
-2
AbstractQuery.php
lib/Doctrine/ORM/AbstractQuery.php
+2
-1
Query.php
lib/Doctrine/ORM/Query.php
+2
-1
QueryCacheTest.php
tests/Doctrine/Tests/ORM/Functional/QueryCacheTest.php
+13
-0
ResultCacheTest.php
tests/Doctrine/Tests/ORM/Functional/ResultCacheTest.php
+15
-0
No files found.
lib/Doctrine/ORM/AbstractQuery.php
View file @
5a96217d
...
...
@@ -548,7 +548,8 @@ abstract class AbstractQuery
}
else
{
$sql
=
$this
->
getSql
();
ksort
(
$this
->
_hints
);
return
md5
(
implode
(
";"
,
(
array
)
$sql
)
.
var_export
(
$params
,
true
)
.
var_export
(
$this
->
_hints
,
true
));
return
md5
(
implode
(
";"
,
(
array
)
$sql
)
.
var_export
(
$params
,
true
)
.
var_export
(
$this
->
_hints
,
true
)
.
"&hydrationMode="
.
$this
->
_hydrationMode
);
}
}
...
...
lib/Doctrine/ORM/Query.php
View file @
5a96217d
...
...
@@ -448,7 +448,8 @@ final class Query extends AbstractQuery
return
md5
(
$this
->
getDql
()
.
var_export
(
$this
->
_hints
,
true
)
.
'firstResult='
.
$this
->
_firstResult
.
'&maxResult='
.
$this
->
_maxResults
.
'DOCTRINE_QUERY_CACHE_SALT'
'&firstResult='
.
$this
->
_firstResult
.
'&maxResult='
.
$this
->
_maxResults
.
'&hydrationMode='
.
$this
->
_hydrationMode
.
'DOCTRINE_QUERY_CACHE_SALT'
);
}
}
\ No newline at end of file
tests/Doctrine/Tests/ORM/Functional/QueryCacheTest.php
View file @
5a96217d
...
...
@@ -67,6 +67,19 @@ class QueryCacheTest extends \Doctrine\Tests\OrmFunctionalTestCase
$this
->
assertEquals
(
$cacheCount
+
1
,
count
(
$cache
->
getIds
()));
}
/**
* @param <type> $query
* @depends testQueryCache_DependsOnHints
*/
public
function
testQueryCache_DependsOnHydrationMode
(
$query
)
{
$cache
=
$query
->
getQueryCacheDriver
();
$cacheCount
=
count
(
$cache
->
getIds
());
$query
->
getArrayResult
();
$this
->
assertEquals
(
$cacheCount
+
1
,
count
(
$cache
->
getIds
()));
}
public
function
testQueryCache_NoHitSaveParserResult
()
{
$this
->
_em
->
getConfiguration
()
->
setQueryCacheImpl
(
null
);
...
...
tests/Doctrine/Tests/ORM/Functional/ResultCacheTest.php
View file @
5a96217d
...
...
@@ -131,4 +131,19 @@ class ResultCacheTest extends \Doctrine\Tests\OrmFunctionalTestCase
$this
->
assertEquals
(
$cacheCount
+
1
,
count
(
$cache
->
getIds
()));
}
/**
* @param <type> $query
* @depends testNativeQueryResultCaching
*/
public
function
testResultCacheDependsOnHydrationMode
(
$query
)
{
$cache
=
$query
->
getResultCacheDriver
();
$cacheCount
=
count
(
$cache
->
getIds
());
$this
->
assertNotEquals
(
\Doctrine\ORM\Query
::
HYDRATE_ARRAY
,
$query
->
getHydrationMode
());
$query
->
getArrayResult
();
$this
->
assertEquals
(
$cacheCount
+
1
,
count
(
$cache
->
getIds
()));
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment