-
Notifications
You must be signed in to change notification settings - Fork 15
Added sorting options to ìbexa:debug:config` #631
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
base: main
Are you sure you want to change the base?
Conversation
e562db5
to
ea930f3
Compare
ea930f3
to
1aad6d2
Compare
|
@@ -95,6 +107,18 @@ protected function execute(InputInterface $input, OutputInterface $output): int | |||
$scope = $input->getOption('scope'); | |||
$parameterData = $this->configResolver->getParameter($parameter, $namespace, $scope); | |||
|
|||
if (null !== ($sort = $input->getOption('sort')) && is_array($parameterData) && is_array($parameterData[0]) && array_key_exists($sort, $parameterData[0]) && is_scalar($parameterData[0][$sort])) { |
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.
Can we somehow simplify this check ?
@@ -95,6 +107,18 @@ protected function execute(InputInterface $input, OutputInterface $output): int | |||
$scope = $input->getOption('scope'); | |||
$parameterData = $this->configResolver->getParameter($parameter, $namespace, $scope); | |||
|
|||
if (null !== ($sort = $input->getOption('sort')) && is_array($parameterData) && is_array($parameterData[0]) && array_key_exists($sort, $parameterData[0]) && is_scalar($parameterData[0][$sort])) { | |||
if ($input->getOption('reverse-sort')) { | |||
usort($parameterData, static function ($a, $b) use ($sort) { |
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.
usort($parameterData, static function ($a, $b) use ($sort) { | |
usort($parameterData, static function ($a, $b): int use ($sort) { |
Could you also please specify types for $a
and $b
?
return $b[$sort] <=> $a[$sort]; | ||
}); | ||
} else { | ||
usort($parameterData, static function ($a, $b) use ($sort) { |
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.
usort($parameterData, static function ($a, $b) use ($sort) { | |
usort($parameterData, static function ($a, $b): int use ($sort) { |
Could you also please specify types for $a
and $b
?
Description:
Sort parameter list when sortable, when it's an array of arrays by a scalar value's key.
For example, see
admin
siteaccess field templates by decreasing priority:php bin/console ibexa:debug:config field_templates --siteaccess admin --sort priority --reverse-sort
For QA:
Documentation: