pimcore / ecommerce-framework-bundle

Ecommerce Framework community bundle provides e-commerce functionality such as product listing and filtering, pricing, carts and checkouts for Pimcore.
https://pimcore.com/docs/platform/Ecommerce_Framework/
Other
8 stars 28 forks source link

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

Open yariksheptykin opened 2 months ago

yariksheptykin commented 2 months ago

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.

github-actions[bot] commented 1 month ago

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.