Skip to content

[Serializer] Fixed array_unique on array of objects in getAllowedAttributes. #16450

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

Closed
wants to merge 5 commits into from

Conversation

ksm2
Copy link
Contributor

@ksm2 ksm2 commented Nov 3, 2015

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #16445
License MIT
Doc PR symfony/symfony-docs#16445

@jakzal
Copy link
Contributor

jakzal commented Nov 3, 2015

Can you add a test case?

$allowedAttributes = array_unique($allowedAttributes);
}

return $allowedAttributes;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be inlined:

return $attributesAsString ? array_unique($allowedAttributes) : $allowedAttributes;

@dunglas
Copy link
Member

dunglas commented Nov 4, 2015

IMO $attributesAsString can just be deleted: #16445 (comment)

@fabpot
Copy link
Member

fabpot commented Nov 7, 2015

IIUC, the array_unique can be removed altogether? If that's the case, let's do that.

@dunglas
Copy link
Member

dunglas commented Nov 7, 2015

It can with the metadata implementation provided in Symfony.

+1 for removing the call and adding a mention in the metadata interface that it's the responsibility of the implantation to return an uniquified list of attributes.

@fabpot
Copy link
Member

fabpot commented Nov 28, 2015

@CornyPhoenix What's the status of this PR?

@ksm2
Copy link
Contributor Author

ksm2 commented Dec 6, 2015

@fabpot I am sorry for the late response. I removed the array_unique statement. Also I added a mention in the ClassMetadataInterface that the stored attribute metadata is a set, not a list, containing not more than one object per attribute.

@dunglas
Copy link
Member

dunglas commented Dec 7, 2015

👍

@fabpot
Copy link
Member

fabpot commented Dec 7, 2015

@dunglas Which version should we merge this PR in?

@dunglas
Copy link
Member

dunglas commented Dec 7, 2015

2.7 IMO but not sure. I'll take a look and merge it.

@fabpot
Copy link
Member

fabpot commented Dec 8, 2015

Thank you @CornyPhoenix.

fabpot added a commit that referenced this pull request Dec 8, 2015
…getAllowedAttributes`. (CornyPhoenix)

This PR was submitted for the master branch but it was merged into the 2.7 branch instead (closes #16450).

Discussion
----------

[Serializer] Fixed `array_unique` on array of objects in `getAllowedAttributes`.

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #16445
| License       | MIT
| Doc PR        | symfony/symfony-docs#16445

Commits
-------

6110bd9 [Serializer] Fixed  on array of objects in .
@fabpot fabpot closed this Dec 8, 2015
@ewgRa
Copy link
Contributor

ewgRa commented Dec 9, 2015

This PR was merged in 2.7, that require "php": ">=5.3.9" but in PR used short array syntax [] at tests and it is intoroduced at 5.4

@fabpot Is it ok, or must be fixed by another PR?

@jakzal
Copy link
Contributor

jakzal commented Dec 9, 2015

@ewgRa short syntax should be removed. Fancy a PR? :)

@ewgRa
Copy link
Contributor

ewgRa commented Dec 9, 2015

@jakzal Sure, I hope PR author ok with that.

#16921

This was referenced Dec 26, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants