File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -78,7 +78,13 @@ final class BookInputDataTransformer implements DataTransformerInterface
78
78
*/
79
79
public function supportsTransformation($data, string $to, array $context = []): bool
80
80
{
81
- return Book::class === $to && $data instanceof BookInput;
81
+ // in the case of an input, the value given here is an array (the JSON decoded).
82
+ // if it's a book we transformed the data already
83
+ if ($data instanceof Book) {
84
+ return false;
85
+ }
86
+
87
+ return Book::class === $to && null !== ($context['input']['class'] ?? null);
82
88
}
83
89
}
84
90
```
@@ -205,7 +211,11 @@ final class BookInputDataTransformer implements DataTransformerInterface
205
211
*/
206
212
public function supportsTransformation($data, string $to, array $context = []): bool
207
213
{
208
- return Book::class === $to && $data instanceof BookInput;
214
+ if ($data instanceof Book) {
215
+ return false;
216
+ }
217
+
218
+ return Book::class === $to && null !== ($context['input']['class'] ?? null);
209
219
}
210
220
}
211
221
```
You can’t perform that action at this time.
0 commit comments