Skip to content
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

Merged

Conversation

robocoder
Copy link
Contributor

and then initialize proxy object.

@robocoder
Copy link
Contributor Author

ping @guilhermeblanco

@guilhermeblanco
Copy link
Contributor

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) {
Copy link
Contributor

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)
schmittjoh added a commit that referenced this pull request Dec 4, 2012
Filter out non-identifiers from $data before calling find()
@schmittjoh schmittjoh merged commit 1a2d7d1 into schmittjoh:master Dec 4, 2012
@robocoder
Copy link
Contributor Author

Thanks for the optimization and quick turnaround on this PR!

$identifierList = array();

foreach ($classMetadata->getIdentifierFieldNames() as $name) {
if ( ! isset($data[$name])) {
Copy link
Contributor

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.

Copy link
Contributor Author

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.

@robocoder
Copy link
Contributor Author

See PR2. Everything else seems ok. Thanks.

schmittjoh pushed a commit that referenced this pull request Jan 6, 2015
bassrock pushed a commit to Klinche/serializer that referenced this pull request Mar 26, 2016
Removed unnecessary namespace duplication
alcalyn pushed a commit to alcalyn/serializer that referenced this pull request May 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants