Skip to content

[Issue] Only load attributes from attribute set of given entity type #39815

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

Open
5 tasks
m2-assistant bot opened this issue Apr 15, 2025 · 0 comments · May be fixed by #39794
Open
5 tasks

[Issue] Only load attributes from attribute set of given entity type #39815

m2-assistant bot opened this issue Apr 15, 2025 · 0 comments · May be fixed by #39794
Labels
Issue: ready for confirmation Reported on 2.4.x Indicates original Magento version for the Issue report.

Comments

@m2-assistant
Copy link

m2-assistant bot commented Apr 15, 2025

This issue is automatically created based on existing pull request: #39794: Only load attributes from attribute set of given entity type


Description

The eav_entity_attribute table can contain attributes of different entity types (from third parties), next to the catalog_product entity type attributes. These attributes can possibly have the same attribute set IDs as the catalog_product entity attribute set IDs.
This can cause issues when loading the attributes by attribute set for a product.

For example: when switching a product's attribute set to a different attribute set, the following snippet will try to delete the data of the product of the old attribute set:
https://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/Catalog/Model/ResourceModel/Product.php#L344-L355

This will result in the following error:

Call to a member function getBackendTable() on bool

On: https://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/Catalog/Model/ResourceModel/Product.php#L373:

Manual testing scenarios

  1. Create a custom entity type, or install a third party extension which adds custom entity types (like https://mirasvit.com/magento-2-extensions/blog.html, which adds blog_post and blog_category entity types), and make sure you have a product attribute set ID with the same attribute set ID of the custom entity type.
  2. Try to switch the attribute set of an existing product, which currently has a product attribute set ID which is the same as one of the custom entity type IDs.
  3. When trying to save the product, the following error will appear:
    Call to a member function getBackendTable() on bool

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • README.md files for modified modules are updated and included in the pull request if any README.md predefined sections require an update
  • All automated tests passed successfully (all builds are green)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue: ready for confirmation Reported on 2.4.x Indicates original Magento version for the Issue report.
Projects
Status: Ready for Confirmation
Development

Successfully merging a pull request may close this issue.

1 participant