yireo / magento2-easier-extension-attributes
N/A
Package info
github.com/yireo/Yireo_EasierExtensionAttributes
Type:magento2-module
pkg:composer/yireo/magento2-easier-extension-attributes
Requires
- php: >=8.2 <8.6
- ext-pcre: *
- magento/framework: ^103.0
- magento/module-catalog: ^104.0
- psr/log: ^1.0 || ^2.0 || ^3.0
Requires (Dev)
- phpunit/phpunit: ^9.5 || ^10.5
- yireo/magento2-integration-test-helper: ~0.0
Suggests
- magento/module-inventory-api: Adds extension attributes to MSI sources
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-11-28 22:42:11 UTC
README
This module tries to make implementing Magento 2 Extension Attributes easier by offering generic DI plugins that hook into various repositories.
Current features
- Creation of plugins for various entities (See
etc/di.xmlfor a listing of current repositories supported) - Saving simple Extension Attributes in the table of the original entity (by copying the Extension Attribute to a data property of the entity and vice versa)
Example
For an example implementation, see YireoTraining_EasierExtensionAttributesExample, more specifically its easier_extension_attributes.xml which complements the regular extension_attributes.xml. For extending the MSI Source entity, it adds a column example to the source database table, which is then automatically filled with the Yireo EasierExtensionAttributes module.
Security notes
- Every column mapped in
easier_extension_attributes.xmlbecomes readable and writable through the REST and GraphQL APIs as an extension attribute. Restrict access by adding<resources>with an ACL resource to the attribute in yourextension_attributes.xml. - Attribute codes and column names must match
[a-z][a-z0-9_]*(max. 64 characters). Identity columns (likeentity_id,row_id,sku,source_code,attribute_set_id,store_id) cannot be mapped. Invalid entries are skipped and logged. - When an extension attribute is not set (
null) or not a scalar value, saving the entity leaves the existing column value untouched.
TODO
- Integration tests for the MSI source repository
- Connect your own simple Extension Attribute with a separate table
- Connect your own Extension Attribute with a custom repository
- Connect your own complex Extension Attribute
- Try to merge
extension_attributes.xmlwitheasier_extension_attributes.xmlto cleanup code - Automatically add extension attributes to frontend and backend forms