File tree Expand file tree Collapse file tree 6 files changed +30
-34
lines changed
Resolver/CacheKey/FactorProvider
GraphQlResolverCache/Model/Resolver/Result/CacheKey Expand file tree Collapse file tree 6 files changed +30
-34
lines changed Original file line number Diff line number Diff line change @@ -101,6 +101,7 @@ function (array $customAttribute) {
101
101
$ customerData ['id ' ] = null ;
102
102
103
103
$ customerData ['model ' ] = $ customer ;
104
+ $ customerData ['model_id ' ] = $ customer ->getId ();
104
105
105
106
//'dob' is deprecated, 'date_of_birth' is used instead.
106
107
if (!empty ($ customerData ['dob ' ])) {
Original file line number Diff line number Diff line change @@ -31,8 +31,8 @@ public function getFactorName(): string
31
31
/**
32
32
* @inheritDoc
33
33
*/
34
- public function getFactorValue (ContextInterface $ context , ? array $ parentValue = null ): string
34
+ public function getFactorValue (ContextInterface $ context , array $ plainParentValue = null ): string
35
35
{
36
- return (string )$ parentValue ['model_id ' ];
36
+ return (string )$ plainParentValue ['model_id ' ];
37
37
}
38
38
}
Original file line number Diff line number Diff line change 10
10
use Exception ;
11
11
use Magento \Framework \ObjectManagerInterface ;
12
12
use Magento \GraphQl \Model \Query \ContextFactoryInterface ;
13
- use Magento \GraphQlResolverCache \Model \Resolver \Result \CacheKey \ParentValue \FactorInterface as ParentValueFactorInterface ;
14
13
use Magento \GraphQlResolverCache \Model \Resolver \Result \CacheKey \ParentValue \ProcessedValueFactorInterface ;
15
14
use Magento \GraphQlResolverCache \Model \Resolver \Result \CacheKey \ParentValue \PlainValueFactorInterface ;
16
15
use Magento \GraphQlResolverCache \Model \Resolver \Result \ValueProcessorInterface ;
@@ -89,7 +88,9 @@ public function calculateCacheKey(?array $parentResolverData = null): ?string
89
88
$ this ->initializeFactorProviderInstances ();
90
89
$ keys = [];
91
90
foreach ($ this ->factorProviderInstances as $ provider ) {
92
- if ($ provider instanceof ParentValueFactorInterface) {
91
+ if ($ provider instanceof ProcessedValueFactorInterface
92
+ || $ provider instanceof PlainValueFactorInterface
93
+ ) {
93
94
// trigger data hydration for key calculation if factor needs the hydrated values
94
95
if (is_array ($ parentResolverData ) && $ provider instanceof ProcessedValueFactorInterface) {
95
96
$ this ->valueProcessor ->preProcessParentValue ($ parentResolverData );
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 7
7
8
8
namespace Magento \GraphQlResolverCache \Model \Resolver \Result \CacheKey \ParentValue ;
9
9
10
+ use Magento \GraphQl \Model \Query \ContextInterface ;
11
+ use Magento \GraphQlResolverCache \Model \Resolver \Result \CacheKey \GenericFactorInterface ;
12
+
10
13
/**
11
14
* Interface for key factors that are used to calculate the resolver cache key.
12
15
*/
13
- interface PlainValueFactorInterface extends FactorInterface
16
+ interface PlainValueFactorInterface extends GenericFactorInterface
14
17
{
15
-
18
+ /**
19
+ * Returns the runtime value that should be used as factor.
20
+ *
21
+ * @param ContextInterface $context
22
+ * @param array|null $plainParentValue
23
+ * @return string
24
+ */
25
+ public function getFactorValue (ContextInterface $ context , array $ plainParentValue = null ): string ;
16
26
}
Original file line number Diff line number Diff line change 7
7
8
8
namespace Magento \GraphQlResolverCache \Model \Resolver \Result \CacheKey \ParentValue ;
9
9
10
+ use Magento \GraphQl \Model \Query \ContextInterface ;
11
+ use Magento \GraphQlResolverCache \Model \Resolver \Result \CacheKey \GenericFactorInterface ;
12
+
10
13
/**
11
14
* Interface for key factors that are used to calculate the resolver cache key.
12
15
*/
13
- interface ProcessedValueFactorInterface extends FactorInterface
16
+ interface ProcessedValueFactorInterface extends GenericFactorInterface
14
17
{
15
-
18
+ /**
19
+ * Returns the runtime value that should be used as factor.
20
+ *
21
+ * @param ContextInterface $context
22
+ * @param array|null $processedParentValue
23
+ * @return string
24
+ */
25
+ public function getFactorValue (ContextInterface $ context , ?array $ processedParentValue = null ): string ;
16
26
}
You can’t perform that action at this time.
0 commit comments