-
-
Notifications
You must be signed in to change notification settings - Fork 585
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
Filter out non-identifiers from $data before calling find() #1
Filter out non-identifiers from $data before calling find() #1
Conversation
ping @guilhermeblanco |
Is this really required? I don't think it's necessary unless it creates partial proxy objects. |
|
||
// Exclude non-identifiers | ||
$filteredIdentifierList = array(); | ||
foreach ($data as $identifier => $value) { |
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.
Missing line break
… initialize proxy object. (cleanup and optimizations per review; rebased)
Filter out non-identifiers from $data before calling find()
Thanks for the optimization and quick turnaround on this PR! |
$identifierList = array(); | ||
|
||
foreach ($classMetadata->getIdentifierFieldNames() as $name) { | ||
if ( ! isset($data[$name])) { |
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.
This is wrong. isset
returns false if you have the key but value is null
.
Null values are accepted as part of composite PKs, so this needs to be addressed here.
To correctly fix the issue, change the method to array_key_exists
.
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.
I'll open a new PR. It feels like something was missed when cherry picking from schmittjoh/JMSSerializerBundle#222.
See PR2. Everything else seems ok. Thanks. |
Removed unnecessary namespace duplication
and then initialize proxy object.