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

[Grid] Support sorting by object brick quantity value field #692

Conversation

BlackbitDevs
Copy link
Contributor

Steps to reproduce:

  1. Create class Car with object brick field attributes
  2. Create object brick Bodywork, assign Car as allowed class and add quantity value field cargoCapacity
  3. Go to grid for Home (aka /), add grid column Bodywork.cargoCapacity and sort by cargoCapacity

Result:
SQL error
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'Bodywork.cargoCapacity' in 'order clause'

This PR fixes this similar as it is done in

} elseif ($class->getFieldDefinition($orderKey) instanceof ClassDefinition\Data\QuantityValue) {
$orderKey = 'concat(' . $orderKey . '__unit, ' . $orderKey . '__value)';
$doNotQuote = true;
} elseif ($class->getFieldDefinition($orderKey) instanceof ClassDefinition\Data\RgbaColor) {
$orderKey = 'concat(' . $orderKey . '__rgb, ' . $orderKey . '__a)';
$doNotQuote = true;
} elseif (strpos($orderKey, '~') !== false) {
for class fields of type quantity value (and RgbaColor).

@BlackbitDevs BlackbitDevs force-pushed the feature/sort-by-objectbrick-quantity-value-field branch from 39ea340 to 25fb6f7 Compare September 17, 2024 05:36
Copy link

sonarcloud bot commented Sep 17, 2024

@mcop1 mcop1 self-assigned this Sep 27, 2024
@mcop1
Copy link
Contributor

mcop1 commented Sep 27, 2024

Thanks 👍

@mcop1 mcop1 merged commit cabafc3 into pimcore:1.5 Sep 27, 2024
11 checks passed
@mcop1 mcop1 added this to the 1.5.5 milestone Sep 27, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Sep 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants