-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Serializer] Argument objects #19277
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
7bd4ac5
e99a90b
e64e999
4884a2e
f361e52
f46a176
93608dc
d4cdb00
5556fa5
3fe9802
e437e04
7b5d55d
98bcb91
988eba1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -319,9 +319,13 @@ protected function instantiateObject(array &$data, $class, array &$context, \Ref | |
$params = array_merge($params, $data[$paramName]); | ||
} | ||
} elseif ($allowed && !$ignored && (isset($data[$key]) || array_key_exists($key, $data))) { | ||
$params[] = $data[$key]; | ||
// don't run set for a parameter passed to the constructor | ||
unset($data[$key]); | ||
$parameterData = $data[$key]; | ||
if (null !== $constructogrParameter->getClass()) { | ||
$parameterData = $this->serializer->denormalize($parameterData, $constructorParameter->getClass()->getName(), null, $context); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would add There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Forgot this comment, it would be a BC break: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @dunglas I'm doing a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also calling There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe can you add a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Cant' we make the normalizer There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be better. But it should be done in another PR. |
||
} | ||
|
||
// Don't run set for a parameter passed to the constructor | ||
$params[] = $parameterData; | ||
} elseif ($constructorParameter->isDefaultValueAvailable()) { | ||
$params[] = $constructorParameter->getDefaultValue(); | ||
} else { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why removing the unset?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bad copy/paste, should be kept