@@ -57,21 +57,20 @@ public function getContext() {
5757 $ hash = '' ;
5858 if ($ request ->attributes ->has ('query ' )) {
5959 $ hash = $ this ->contextCache [$ request ] = $ this ->getHash (
60- $ request ->attributes ->get ('id ' ) ?: '' ,
60+ $ request ->attributes ->get ('schema ' ) ?: '' ,
6161 $ request ->attributes ->get ('query ' ) ?: '' ,
62- $ request ->attributes ->get ('variables ' ) ?: [],
63- $ request ->attributes ->get ('version ' ) ?: ''
62+ $ request ->attributes ->get ('variables ' ) ?: []
6463 );
6564 }
6665 else if ($ request ->attributes ->has ('queries ' )) {
6766 $ queries = $ request ->attributes ->get ('queries ' );
67+ $ schema = $ request ->attributes ->get ('schema ' ) ?: '' ;
6868
69- return hash ('sha256 ' , json_encode (array_map (function ($ item ) {
69+ return hash ('sha256 ' , json_encode (array_map (function ($ item ) use ( $ schema ) {
7070 return $ this ->getHash (
71- ! empty ( $ item [ ' id ' ]) ? $ item [ ' id ' ] : '' ,
71+ $ schema ,
7272 !empty ($ item ['query ' ]) ? $ item ['query ' ] : '' ,
73- !empty ($ item ['variables ' ]) ? $ item ['variables ' ] : [],
74- !empty ($ item ['version ' ]) ? $ item ['version ' ] : NULL
73+ !empty ($ item ['variables ' ]) ? $ item ['variables ' ] : []
7574 );
7675 }, $ queries )));
7776 }
@@ -85,27 +84,24 @@ public function getContext() {
8584 * Sorts the variables by their key and eliminates whitespace from the query
8685 * to enable better reuse of the cache entries.
8786 *
88- * @param string $id
89- * The query id in case of a persisted query .
87+ * @param string $schema
88+ * The schema id.
9089 * @param string $query
9190 * The graphql query string.
9291 * @param array $variables
9392 * The graphql query variables.
94- * @param string $version
95- * The query map version in case of a persisted query.
9693 *
9794 * @return string
9895 * The hashed string containing.
9996 */
100- protected function getHash ($ id = '' , $ query = '' , array $ variables = [], $ version = '' ) {
97+ protected function getHash ($ schema = '' , $ query = '' , array $ variables = []) {
10198 $ query = preg_replace ('/\s{2,}/ ' , ' ' , $ query );
10299 ksort ($ variables );
103100
104101 return hash ('sha256 ' , json_encode ([
105- 'id ' => $ id ,
102+ 'schema ' => $ schema ,
106103 'query ' => $ query ,
107104 'variables ' => $ variables ,
108- 'version ' => $ version ,
109105 ]));
110106 }
111107
0 commit comments