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

[DataObjectController] getSelectOptions method is not taking into account the current draft #630

Open
nbb-content opened this issue Jul 25, 2024 · 4 comments

Comments

@nbb-content
Copy link

Situation

The getSelectOptions-mechanism fails with error message "Call to undefined method getLocalizedfields".

The data is send correctly to the DataObjectController from the Steps to reproduce. The method getSelectOptions gets the object from the database which does not contain the changes from the draft, by this the indexes are wrong and it tries to get the localizedFields for the BulletPointElements from the BulletPointCustomProperty, which doesn't contain localizedFields.

In addition to this, we figured out in another place (when using FieldSet and a Select field) that we have the same issue. Again the method getSelectOptions gets the object from the database which does not contain the changes from the draft but now by this the OptionProvider is not called anymore and all the select options are empty. A different place and configuration but both use the getSelectOptionsmethod and have the same behaviour not containing the changes from the draft.

Steps to reproduce

A similar issue was already reported in pimcore/pimcore#9645

  1. Add a new BulletPointElements before a BulletPointCustomProperty which already exists
  2. Click inside of the select box of the BulletPointElements
  3. Error Call to undefined method getLocalizedfields is thrown

Environment

Pimcore: 11.3.1
Indirectly due to Pimcore version: admin-ui-classic-bundle: ^1.5.0

Structure

We have two field collection set once the bulletPointElements and second the bulletPointCustomProperty. The bulletPointElements are set up with a localized field.

BulletPointElements Structure:
bulletPointElements

BulletPointCustomProperty Structure:
bulletPointCustomProperty

Solution which was working for us

Add the same two code lines which are already used in the saveAction (L1317 & L1324), inside of the getSelectOptions in line 558:

$objectFromDatabase = DataObject\Concrete::getById($objectId);
$object = $this->getLatestVersion($objectFromDatabase);

We assume this part is just missing there.

Copy link

Thanks a lot for reporting the issue. We did not consider the issue as "Pimcore:Priority", "Pimcore:ToDo" or "Pimcore:Backlog", so we're not going to work on that anytime soon. Please create a pull request to fix the issue if this is a bug report. We'll then review it as quickly as possible. If you're interested in contributing a feature, please contact us first here before creating a pull request. We'll then decide whether we'd accept it or not. Thanks for your understanding.

@fashxp
Copy link
Member

fashxp commented Aug 16, 2024

A PR to fix this would be nice indeed.

@nbb-content
Copy link
Author

Alright! We will provide a PR as soon as possible :)

@nbb-content
Copy link
Author

PR provided.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants