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

Revert using defaults.order as collection.order #4178

Merged
merged 4 commits into from
Mar 31, 2021
Merged

Revert using defaults.order as collection.order #4178

merged 4 commits into from
Mar 31, 2021

Conversation

guilliamxavier
Copy link
Contributor

Q A
Branch? 2.6
Bug fix? yes
New feature? no
Deprecations? no
Tickets Fix #4170
License MIT
Doc PR

@@ -58,7 +58,7 @@ public function applyToCollection(Builder $aggregationBuilder, string $resourceC
if (empty($defaultOrder)) {
$defaultOrder = $this->resourceMetadataFactory->create($resourceClass)->getAttribute('order');
}
if (\is_array($defaultOrder)) {
if (null !== $defaultOrder) {
Copy link
Member

Choose a reason for hiding this comment

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

Isn't it better to keep is_array?

Copy link
Contributor Author

@guilliamxavier guilliamxavier Mar 31, 2021

Choose a reason for hiding this comment

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

I don't know, because:

  • I consistently reverted all the changes of 3492922
  • With null !== (like it was originally) an incorrect config (e.g. a string value) gives you a Warning "Invalid argument supplied for foreach()" (then you fix your config 😉), with is_array() it is silently ignored (until you notice your config isn't applied? 😕)
  • See also Fix behaviour of "order" attribute #3472

But if you deem this part of the revert too risky, I can drop it (just say it)

Copy link
Member

Choose a reason for hiding this comment

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

Not sure which one is the better 😅 Keep it like this, it's alright.

@alanpoulain alanpoulain merged commit f672334 into api-platform:2.6 Mar 31, 2021
@alanpoulain
Copy link
Member

Thanks 🙂

@guilliamxavier guilliamxavier deleted the patch-1 branch March 31, 2021 14:02
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.

None yet

2 participants