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

Fix values in shown fields in relations #16570

Open
wants to merge 2 commits into
base: 11.2
Choose a base branch
from

Conversation

noahcommandeur-twocream
Copy link
Contributor

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

@CLAassistant
Copy link

CLAassistant commented Feb 7, 2024

CLA assistant check
All committers have signed the CLA.

Copy link

github-actions bot commented Feb 7, 2024

Review Checklist

  • Target branch (11.1 for bug fixes, others 11.x)
  • Tests (if it's testable code, there should be a test for it - get help)
  • Docs (every functionality needs to be documented, see here)
  • Migration incl. install.sql (e.g. if the database schema changes, ...)
  • Upgrade notes (deprecations, important information, migration hints, ...)
  • Label
  • Milestone

Copy link

sonarcloud bot commented Feb 7, 2024

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@kingjia90 kingjia90 deleted the branch pimcore:11.2 March 12, 2024 15:13
@kingjia90 kingjia90 closed this Mar 12, 2024
@kingjia90 kingjia90 reopened this Mar 13, 2024
@kingjia90 kingjia90 changed the base branch from 11.1 to 11.2 March 13, 2024 07:41
@lukmzig lukmzig added this to the 11.2.2 milestone Mar 22, 2024
@lukmzig lukmzig self-assigned this Mar 22, 2024
@lukmzig lukmzig added the Bug label Mar 22, 2024
Copy link
Contributor

@lukmzig lukmzig left a 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?

@kingjia90 kingjia90 modified the milestones: 11.2.2, 11.2.3 Mar 26, 2024
Co-authored-by: lukmzig <30526586+lukmzig@users.noreply.github.com>
Copy link

sonarcloud bot commented Apr 5, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

@noahcommandeur-twocream
Copy link
Contributor Author

I have the following class definition:
image

Let's assume we write "test german" for German and "test english" for English in the input field, when we go to the GridView "test english" is displayed although the "user language" should be displayed in my case then "test german",
image

@fashxp
Copy link
Member

fashxp commented Apr 5, 2024

hmm, maybe I miss something, but isn't the data language of the grid defined in the grid configuration?
image

Comment on lines 435 to 440
$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);
Copy link
Contributor

@kingjia90 kingjia90 Apr 23, 2024

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

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);
}
}

@kingjia90 kingjia90 modified the milestones: 11.2.3, 11.2.4 Apr 23, 2024
@lukmzig
Copy link
Contributor

lukmzig commented May 3, 2024

@noahcommandeur-twocream can you please check if your issue is same as reported here: #16954

If so, there was another fix just merged: #17006
Could you please verify if this also resolves your issue?

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.

None yet

6 participants