Skip to content

Refresh facet indexes on product save with application model classes - #302

Open
Darkorzerarko wants to merge 1 commit into
BitBagCommerce:masterfrom
Darkorzerarko:fix/facet-indexes-refresh-with-custom-models
Open

Darkorzerarko wants to merge 1 commit into
BitBagCommerce:masterfrom
Darkorzerarko:fix/facet-indexes-refresh-with-custom-models

Conversation

@Darkorzerarko

Copy link
Copy Markdown

Fixes #301, likely also the cause of #232.

ResourceIndexListener compared the configured attribute and option models with Sylius' base classes by name, so in
applications with their own model classes (the Sylius Standard default) saving a product or variant never refreshed
bitbag_attribute_taxons and bitbag_option_taxons. The models are now checked by interface:

if (is_a($config[self::MODEL_KEY], ProductAttributeInterface::class, true)) {

Added ResourceIndexListenerSpec; the application-model examples fail without the fix. PHPStan passes, and phpspec has no new failures (the 6 broken examples are broken on master too).

ResourceIndexListener compared the configured attribute and option models
with Sylius' base classes by name. In applications that map them to their
own classes (the Sylius Standard default), saving a product or variant
never refreshed bitbag_attribute_taxons and bitbag_option_taxons. Check
the models against ProductAttributeInterface and ProductOptionInterface
instead.

Fixes BitBagCommerce#301
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.

Attribute and option facet indexes are not refreshed on product save when the application uses its own model classes

1 participant