Skip to content

Commit 8aaa843

Browse files
committed
fix #2230
1 parent d7c1d74 commit 8aaa843

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

core/content-negotiation.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,14 @@ final class CustomItemNormalizer implements NormalizerInterface, DenormalizerInt
309309
{
310310
return $this->normalizer->supportsNormalization($data, $format);
311311
}
312+
313+
public function getSupportedTypes(?string $format): array
314+
{
315+
return [
316+
'object' => null,
317+
'*' => false,
318+
];
319+
}
312320
}
313321
```
314322

@@ -348,6 +356,8 @@ class CustomItemNormalizer implements NormalizerInterface, DenormalizerInterface
348356
}
349357
```
350358

359+
Read more about the [serialization here](./serialization) or check out how to decode [Form Data](./form-data)
360+
351361
### Contributing Support for New Formats
352362

353363
Adding support for **standard** formats upstream is welcome! We'll be glad to

core/serialization.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,6 +1042,13 @@ class BookAttributeNormalizer implements NormalizerInterface, NormalizerAwareInt
10421042
// for the current $object (book) and
10431043
// return true or false
10441044
}
1045+
1046+
public function getSupportedTypes(?string $format): array
1047+
{
1048+
return [
1049+
Book::class => true
1050+
];
1051+
}
10451052
}
10461053
```
10471054

@@ -1149,6 +1156,11 @@ final class ApiNormalizer implements NormalizerInterface, DenormalizerInterface,
11491156
$this->decorated->setSerializer($serializer);
11501157
}
11511158
}
1159+
1160+
public function getSupportedTypes(?string $format): array
1161+
{
1162+
return $this->decorated->getSupportedTypes($format);
1163+
}
11521164
}
11531165
```
11541166

0 commit comments

Comments
 (0)