Skip to content

Commit d710c88

Browse files
committed
minor symfony#10594 Fixes var name in callback (mauricesvay)
This PR was merged into the master branch. Discussion ---------- Fixes var name in callback <!-- If your pull request fixes a BUG, use the oldest maintained branch that contains the bug (see https://symfony.com/roadmap for the list of maintained branches). If your pull request documents a NEW FEATURE, use the same Symfony branch where the feature was introduced (and `master` for features of unreleased versions). --> Commits ------- 48b1fec Fixes var name in callback
2 parents e350b3e + 48b1fec commit d710c88

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

components/serializer.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ When serializing, you can set a callback to format a specific object property::
629629

630630
// all callback parameters are optional (you can omit the ones you don't use)
631631
$callback = function ($innerObject, $outerObject, string $attributeName, string $format = null, array $context = array()) {
632-
return $dateTime instanceof \DateTime ? $dateTime->format(\DateTime::ISO8601) : '';
632+
return $innerObject instanceof \DateTime ? $innerObject->format(\DateTime::ISO8601) : '';
633633
};
634634

635635
$normalizer->setCallbacks(array('createdAt' => $callback));

0 commit comments

Comments
 (0)