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

Support "store" field type in grid #2262

Merged
merged 2 commits into from May 2, 2023

Conversation

BlackbitDevs
Copy link
Contributor

@BlackbitDevs BlackbitDevs commented Apr 27, 2023

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no

If show a coreShopStore (store select) field in grid you'll get no data

Снимок экрана 2023-04-27 в 17 02 21

This is because CoreShop\Bundle\StoreBundle\CoreExtension\Store class hasn't method getDataForGrid

This method with all dependent methods setOptions and getOptions was copied from https://github.com/pimcore/pimcore/blob/10.5/models/DataObject/ClassDefinition/Data/Select.php (because Coreshop does not extend Pimcore's Select field type)
Only return data was changed from return $data; to return $data?->getId(); because the getter returns a Store object via

return $this->getRepository()->find($data);

The most important point why it did not work is that in
https://github.com/pimcore/pimcore/blob/a5b86f3f9a63ac76282acee00879fb52b416a4ce/bundles/AdminBundle/Resources/public/js/pimcore/object/tags/select.js#L99
field.layout.optionsProviderClass is checked. This refers to a public field optionsProviderClass in the Store PHP class which did not exist before (only the getOptionsProviderClass() existed) and caused a JS error because of accessing a non-existing object property.

With this PR it looks like this
Снимок экрана 2023-04-27 в 17 04 10

@BlackbitDevs BlackbitDevs changed the title Show stores in grid Support "store" field type in grid Apr 27, 2023
@BlackbitDevs BlackbitDevs marked this pull request as ready for review April 27, 2023 15:06
@dpfaffenbauer
Copy link
Member

@BlackbitDevs NICE :), can we rebase it to 3.0?

@BlackbitDevs BlackbitDevs changed the base branch from master to 3.0 April 28, 2023 06:32
@BlackbitDevs BlackbitDevs changed the base branch from 3.0 to master April 28, 2023 06:32
@BlackbitDevs BlackbitDevs changed the base branch from master to 3.0 April 28, 2023 06:36
@BlackbitDevs
Copy link
Contributor Author

Is now rebased to 3.0

@dpfaffenbauer
Copy link
Member

@BlackbitDevs tests are failing

@dpfaffenbauer dpfaffenbauer merged commit 7a6d012 into coreshop:3.0 May 2, 2023
208 checks passed
@dpfaffenbauer
Copy link
Member

@BlackbitDevs thank you very much

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

Successfully merging this pull request may close these issues.

None yet

2 participants