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
Fix values in shown fields in relations #16570
base: 11.2
Are you sure you want to change the base?
Fix values in shown fields in relations #16570
Conversation
Review Checklist
|
Quality Gate passedKudos, no new issues were introduced! 0 New issues |
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.
@noahcommandeur-twocream thank you for the PR!
I have a small suggestion, but except that I was unfortunately not able to reproduce this issue.
Can you please share your grid configuration? I am not completely sure if I am getting the use-case correctly.
You have a class definition and in it there is localized fields. Inside localized fields there is many to many relation with visible fields set up and those should be visible in the grid view?
Co-authored-by: lukmzig <30526586+lukmzig@users.noreply.github.com>
Quality Gate passedIssues Measures |
$inheritanceBackup = AbstractObject::getGetInheritedValues(); | ||
AbstractObject::setGetInheritedValues(true); | ||
|
||
$data[$dataKey] = $object->get($key, $user->getLanguage()); | ||
$data[$dataKey] = $object->get($key, $user?->getLanguage()); | ||
|
||
AbstractObject::setGetInheritedValues(false); | ||
AbstractObject::setGetInheritedValues($inheritanceBackup); |
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.
recommending to use useInheritedValues
, if that's the same intended change
pimcore/models/DataObject/Service.php
Lines 1962 to 1972 in 79e57f1
public static function useInheritedValues(bool $inheritValues, callable $fn, array $fnArgs = []): mixed | |
{ | |
$backup = DataObject::getGetInheritedValues(); | |
DataObject::setGetInheritedValues($inheritValues); | |
try { | |
return $fn(...$fnArgs); | |
} finally { | |
DataObject::setGetInheritedValues($backup); | |
} | |
} |
@noahcommandeur-twocream can you please check if your issue is same as reported here: #16954 If so, there was another fix just merged: #17006 |
Situation:
Create a many to many object relationship under a localised field. Then set the visible fields there.
You will see that these fields are not filled in the "Preview".
Expected Behaviour:
In the Relation & Grid View, the values should be displayed for the configured fields
Fix:
Use the getter function and access the field directly, allow the use of inherited values so that this also works correctly in the grid view