1 | <?php |
||
22 | abstract class FieldPluginBase extends PluginBase implements TypeSystemPluginInterface, SecureFieldInterface { |
||
23 | use CacheablePluginTrait; |
||
24 | use NamedPluginTrait; |
||
25 | use ArgumentAwarePluginTrait; |
||
26 | |||
27 | /** |
||
28 | * The field instance. |
||
29 | * |
||
30 | * @var \Drupal\graphql\GraphQL\Field\Field |
||
31 | */ |
||
32 | protected $definition; |
||
33 | |||
34 | /** |
||
35 | * {@inheritdoc} |
||
36 | */ |
||
37 | public function getDefinition(PluggableSchemaBuilderInterface $schemaBuilder) { |
||
60 | |||
61 | /** |
||
62 | * {@inheritdoc} |
||
63 | */ |
||
64 | public function isSecure() { |
||
67 | |||
68 | /** |
||
69 | * Dummy implementation for `getBatchId` in `BatchedFieldInterface`. |
||
70 | * |
||
71 | * This provides an empty implementation of `getBatchId` in case the subclass |
||
72 | * implements `BatchedFieldInterface`. In may cases this will suffice since |
||
73 | * the batches are already grouped by the class implementing `resolveBatch`. |
||
74 | * `getBatchId` is only necessary for cases where batch grouping depends on |
||
75 | * runtime arguments. |
||
76 | * |
||
77 | * @param mixed $parent |
||
78 | * The parent value in the result tree. |
||
79 | * @param array $arguments |
||
80 | * The list of arguments. |
||
81 | * @param ResolveInfo $info |
||
82 | * The graphql resolve info object. |
||
83 | * |
||
84 | * @return string |
||
85 | * The batch key. |
||
86 | */ |
||
87 | public function getBatchId($parent, array $arguments, ResolveInfo $info) { |
||
90 | |||
91 | /** |
||
92 | * {@inheritdoc} |
||
93 | */ |
||
94 | public function resolve($value, array $args, ResolveInfo $info) { |
||
106 | |||
107 | /** |
||
108 | * Wrap the result in a CacheableValue. |
||
109 | * |
||
110 | * @param mixed $result |
||
111 | * The field result. |
||
112 | * @param mixed $value |
||
113 | * The parent value. |
||
114 | * @param array $args |
||
115 | * The field arguments. |
||
116 | * |
||
117 | * @return CacheableValue |
||
118 | * The cacheable value. |
||
119 | */ |
||
120 | protected function cacheable($result, $value, array $args) { |
||
131 | |||
132 | /** |
||
133 | * Retrieve the list of cache dependencies for a given value and arguments. |
||
134 | * |
||
135 | * @param mixed $result |
||
136 | * The result of the field. |
||
137 | * @param mixed $parent |
||
138 | * The parent value. |
||
139 | * @param array $args |
||
140 | * The arguments passed to the field. |
||
141 | * |
||
142 | * @return array |
||
143 | * A list of cacheable dependencies. |
||
144 | */ |
||
145 | protected function getCacheDependencies($result, $parent, array $args) { |
||
149 | |||
150 | /** |
||
151 | * Retrieve the list of field values. |
||
152 | * |
||
153 | * Always returns a list of field values. Even for single value fields. |
||
154 | * Single/multi field handling is responsibility of the base class. |
||
155 | * |
||
156 | * @param mixed $value |
||
157 | * The current object value. |
||
158 | * @param array $args |
||
159 | * Field arguments. |
||
160 | * @param \Youshido\GraphQL\Execution\ResolveInfo $info |
||
161 | * The resolve info object. |
||
162 | * |
||
163 | * @return \Generator |
||
164 | * The value generator. |
||
165 | */ |
||
166 | protected function resolveValues($value, array $args, ResolveInfo $info) { |
||
170 | |||
171 | } |
||
172 |
It seems like you are assigning to a variable which was imported through a
use
statement which was not imported by reference.For clarity, we suggest to use a different name or import by reference depending on whether you would like to have the change visibile in outer-scope.
Change not visible in outer-scope
Change visible in outer-scope