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

[Bug]: Mismatching return type in `...\Fieldcollection\Data\FilterSelectClsStoreAttributes::getField() #184

Open
yariksheptykin opened this issue May 22, 2024 · 1 comment

Comments

@yariksheptykin
Copy link

Expected behavior

\Pimcore\Model\DataObject\Fieldcollection\Data\FilterSelectClsStoreAttributes::getField() return type is compatible with
getField() return type in its parent class.

Actual behavior

With opcache preloading enabled, the following error prevents php-fpm from starting:

PHP Fatal error:  Declaration of Pimcore\Model\DataObject\Fieldcollection\Data\FilterSelectClsStoreAttributes::getField(): ?Pimcore\Bundle\EcommerceFrameworkBundle\CoreExtensions\ObjectData\IndexFieldSelection must be compatible with Pimcore\Bundle\EcommerceFrameworkBundle\Model\CategoryFilterDefinitionType::getField(): string in /var/www/html/var/classes/DataObject/Fieldcollection/Data/FilterSelectClsStoreAttributes.php on line 63

FilterSelectClsStoreAttributes is defined in src/Resources/install/fieldcollection_sources/fieldcollection_FilterSelectClsStoreAttributes_export.json.
The property field is defined as IndexFieldSelection in the json file.
The parent class for FilterSelectClsStoreAttributes is CategoryFilterDefinitionType.
CategoryFilterDefinitionType::getField() returns string, which is incompatible with FilterSelectClsStoreAttributes::getField() return type.

Definition of FilterSelectClsStoreAttributes::getField() is compatible with \Pimcore\Bundle\EcommerceFrameworkBundle\Model\AbstractFilterDefinitionType::getField(), which is the parent of CategoryFilterDefinitionType.
We either need to change the parent type of FilterSelectClsStoreAttributes to AbstractFilterDefinitionType or change the return type of CategoryFilterDefinitionType::getField() to include IndexFieldSelection also.

Steps to reproduce

Install pimcore with ecommerce-framework-bundle. Rebuild php classes: bin/console pimcore:build:classes and inspect generated \Pimcore\Model\DataObject\Fieldcollection\Data\FilterSelectClsStoreAttributes::getField() method.

@yariksheptykin yariksheptykin changed the title [Bug]: Mismatching return types in `...\Fieldcollection\Data\FilterSelectClsStoreAttributes::getField() [Bug]: Mismatching return type in `...\Fieldcollection\Data\FilterSelectClsStoreAttributes::getField() May 22, 2024
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.

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

1 participant