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) { |
||
104 | |||
105 | /** |
||
106 | * {@inheritdoc} |
||
107 | */ |
||
108 | public function resolveDeferred(callable $callback, $value, array $args, ResolveInfo $info) { |
||
117 | |||
118 | /** |
||
119 | * Wrap the result in a CacheableValue. |
||
120 | * |
||
121 | * @param mixed $result |
||
122 | * The field result. |
||
123 | * @param mixed $value |
||
124 | * The parent value. |
||
125 | * @param array $args |
||
126 | * The field arguments. |
||
127 | * |
||
128 | * @return CacheableValue |
||
129 | * The cacheable value. |
||
130 | */ |
||
131 | protected function cacheable($result, $value, array $args) { |
||
142 | |||
143 | /** |
||
144 | * Retrieve the list of cache dependencies for a given value and arguments. |
||
145 | * |
||
146 | * @param mixed $result |
||
147 | * The result of the field. |
||
148 | * @param mixed $parent |
||
149 | * The parent value. |
||
150 | * @param array $args |
||
151 | * The arguments passed to the field. |
||
152 | * |
||
153 | * @return array |
||
154 | * A list of cacheable dependencies. |
||
155 | */ |
||
156 | protected function getCacheDependencies($result, $parent, array $args) { |
||
160 | |||
161 | /** |
||
162 | * Retrieve the list of field values. |
||
163 | * |
||
164 | * Always returns a list of field values. Even for single value fields. |
||
165 | * Single/multi field handling is responsibility of the base class. |
||
166 | * |
||
167 | * @param mixed $value |
||
168 | * The current object value. |
||
169 | * @param array $args |
||
170 | * Field arguments. |
||
171 | * @param \Youshido\GraphQL\Execution\ResolveInfo $info |
||
172 | * The resolve info object. |
||
173 | * |
||
174 | * @return \Generator |
||
175 | * The value generator. |
||
176 | */ |
||
177 | protected function resolveValues($value, array $args, ResolveInfo $info) { |
||
181 | |||
182 | } |
||
183 |
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