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) {
101101 $ customerData ['id ' ] = null ;
102102
103103 $ customerData ['model ' ] = $ customer ;
104+ $ customerData ['model_id ' ] = $ customer ->getId ();
104105
105106 //'dob' is deprecated, 'date_of_birth' is used instead.
106107 if (!empty ($ customerData ['dob ' ])) {
Original file line number Diff line number Diff line change @@ -31,8 +31,8 @@ public function getFactorName(): string
3131 /**
3232 * @inheritDoc
3333 */
34- public function getFactorValue (ContextInterface $ context , ? array $ parentValue = null ): string
34+ public function getFactorValue (ContextInterface $ context , array $ plainParentValue = null ): string
3535 {
36- return (string )$ parentValue ['model_id ' ];
36+ return (string )$ plainParentValue ['model_id ' ];
3737 }
3838}
Original file line number Diff line number Diff line change 1010use Exception ;
1111use Magento \Framework \ObjectManagerInterface ;
1212use Magento \GraphQl \Model \Query \ContextFactoryInterface ;
13- use Magento \GraphQlResolverCache \Model \Resolver \Result \CacheKey \ParentValue \FactorInterface as ParentValueFactorInterface ;
1413use Magento \GraphQlResolverCache \Model \Resolver \Result \CacheKey \ParentValue \ProcessedValueFactorInterface ;
1514use Magento \GraphQlResolverCache \Model \Resolver \Result \CacheKey \ParentValue \PlainValueFactorInterface ;
1615use Magento \GraphQlResolverCache \Model \Resolver \Result \ValueProcessorInterface ;
@@ -89,7 +88,9 @@ public function calculateCacheKey(?array $parentResolverData = null): ?string
8988 $ this ->initializeFactorProviderInstances ();
9089 $ keys = [];
9190 foreach ($ this ->factorProviderInstances as $ provider ) {
92- if ($ provider instanceof ParentValueFactorInterface) {
91+ if ($ provider instanceof ProcessedValueFactorInterface
92+ || $ provider instanceof PlainValueFactorInterface
93+ ) {
9394 // trigger data hydration for key calculation if factor needs the hydrated values
9495 if (is_array ($ parentResolverData ) && $ provider instanceof ProcessedValueFactorInterface) {
9596 $ this ->valueProcessor ->preProcessParentValue ($ parentResolverData );
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 77
88namespace Magento \GraphQlResolverCache \Model \Resolver \Result \CacheKey \ParentValue ;
99
10+ use Magento \GraphQl \Model \Query \ContextInterface ;
11+ use Magento \GraphQlResolverCache \Model \Resolver \Result \CacheKey \GenericFactorInterface ;
12+
1013/**
1114 * Interface for key factors that are used to calculate the resolver cache key.
1215 */
13- interface PlainValueFactorInterface extends FactorInterface
16+ interface PlainValueFactorInterface extends GenericFactorInterface
1417{
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 ;
1626}
Original file line number Diff line number Diff line change 77
88namespace Magento \GraphQlResolverCache \Model \Resolver \Result \CacheKey \ParentValue ;
99
10+ use Magento \GraphQl \Model \Query \ContextInterface ;
11+ use Magento \GraphQlResolverCache \Model \Resolver \Result \CacheKey \GenericFactorInterface ;
12+
1013/**
1114 * Interface for key factors that are used to calculate the resolver cache key.
1215 */
13- interface ProcessedValueFactorInterface extends FactorInterface
16+ interface ProcessedValueFactorInterface extends GenericFactorInterface
1417{
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 ;
1626}
You can’t perform that action at this time.
0 commit comments