Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions components/serializer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -799,8 +799,8 @@ When serializing, you can set a callback to format a specific object property::
$encoder = new JsonEncoder();

// all callback parameters are optional (you can omit the ones you don't use)
$dateCallback = function ($innerObject, $outerObject, string $attributeName, ?string $format = null, array $context = []) {
return $innerObject instanceof \DateTime ? $innerObject->format(\DateTime::ATOM) : '';
$dateCallback = function ($attributeValue, $object, string $attributeName, ?string $format = null, array $context = []) {
return $attributeValue instanceof \DateTime ? $attributeValue->format(\DateTime::ATOM) : '';
};

$defaultContext = [
Expand Down
Loading