mage-os/module-eav-debug-views
Composer 安装命令:
composer require --dev mage-os/module-eav-debug-views
包简介
Database views to aggregate EAV entity data for easier data analysis.
README 文档
README
Developer utility module for Magento 2.4.x that creates database views aggregating EAV entity data with attribute values in JSON format.
Important
This module is designed for development and debugging.
While production-installable, consider these factors:
- Database views may impact performance on large datasets
- JSON aggregation is resource-intensive for complex queries
- Intended for temporary debugging, not permanent production use
- No query optimization beyond entity_id lookups
Suggested Use: Install in development/staging only. Do not write code that would use these views on a live site.
Requirements
- Magento: 2.4.x
- PHP: 8.1+
- Database: MySQL 5.7+ or MariaDB 10.2.3+
- Requires MySQL
JSONfunction support
- Requires MySQL
Installation
composer require --dev mage-os/module-eav-debug-views bin/magento setup:upgrade
Created Views
1. dev_product
Combines catalog_product_entity with all EAV attributes aggregated as JSON.
Columns:
- All
catalog_product_entitycolumns (entity_id, sku, type_id, etc.) eav_attributes(JSON) - All EAV attribute values from decimal, datetime, int, text, varchar tables
Example Query:
SELECT entity_id, sku, type_id, JSON_PRETTY(eav_attributes) as attributes FROM dev_product WHERE sku = 'my-product-sku';
Extract Specific Attributes:
SELECT entity_id, sku, JSON_EXTRACT(eav_attributes, '$.name') as name, JSON_EXTRACT(eav_attributes, '$.price') as price, JSON_EXTRACT(eav_attributes, '$.status') as status FROM dev_product WHERE entity_id = 1;
2. dev_category
Combines catalog_category_entity with EAV attributes.
Columns:
- All
catalog_category_entitycolumns (entity_id, path, level, etc.) eav_attributes(JSON) - All EAV attribute values from decimal, datetime, int, text, varchar tables
Example Query:
SELECT entity_id, parent_id, path, level, JSON_EXTRACT(eav_attributes, '$.name') as name, JSON_EXTRACT(eav_attributes, '$.is_active') as is_active FROM dev_category WHERE level = 2;
3. dev_customer
Combines customer_entity with EAV attributes.
Columns:
- All
customer_entitycolumns (entity_id, firstname, lastname, email, etc.) eav_attributes(JSON) - All EAV attribute values from decimal, datetime, int, text, varchar tables
Example Query:
SELECT entity_id, email, firstname, lastname, JSON_PRETTY(eav_attributes) as custom_attributes FROM dev_customer WHERE email LIKE '%@example.com';
4. dev_address
Combines customer_address_entity with EAV attributes.
Columns:
- All
customer_address_entitycolumns (entity_id, firstname, lastname, street, city, etc.) eav_attributes(JSON) - All EAV attribute values from decimal, datetime, int, text, varchar tables
Example Query:
SELECT entity_id, parent_id, city, country_id, JSON_PRETTY(eav_attributes) as custom_attributes FROM dev_address WHERE parent_id = 1;
5. dev_product_attribute
Quick reference for product attribute metadata.
Columns:
- All
eav_attributecolumns (attribute_id, attribute_code, etc.) - All
catalog_eav_attributecolumns (is_searchable, is_filterable, used_in_product_listing, etc.) attribute_sets(JSON) - All attribute sets and groups the attribute is assigned to, including IDs, names, and sort order.- @TODO: Add
eav_optionswith all option IDs and values for DB-storedselectandmultiselect-type attributes.
Example Query:
SELECT attribute_id, attribute_code, backend_type, frontend_input, is_filterable, is_searchable, position, attribute_sets FROM dev_product_attribute WHERE is_filterable=1 ORDER BY attribute_code;
Store Scope
All EAV views aggregate all store_id values into a single JSON object per entity.
Store-specific attribute keys use the format attribute_code:store_id (e.g., name:1, name:2).
Global attributes (store_id = 0) use just the attribute_code (e.g., name, sku).
Example - Querying store-specific values:
-- Get product with global and store-specific names SELECT entity_id, sku, JSON_EXTRACT(eav_attributes, '$.name') as global_name, JSON_EXTRACT(eav_attributes, '$.\"name:1\"') as store_1_name, JSON_EXTRACT(eav_attributes, '$.\"name:2\"') as store_2_name FROM dev_product WHERE sku = 'my-product'; -- See all attribute values including store-specific SELECT entity_id, sku, JSON_PRETTY(eav_attributes) as all_attributes FROM dev_product WHERE entity_id = 1;
For technical reasons, we can't sort attributes alphabetically. Scoped values for an attribute may appear anywhere within the JSON. (MySQL does not support sorting values within JSON_OBJECTAGG(...) in ONLY_FULL_GROUP_BY mode.)
Performance Considerations
Query Optimization
If filtering by attribute values, be careful about the amount of records processed.
Fast:
-- Uses entity table index SELECT * FROM dev_product WHERE entity_id = 123; SELECT * FROM dev_product WHERE sku = 'ABC123';
Not fast:
-- Full table scan with JSON parsing SELECT * FROM dev_product WHERE JSON_EXTRACT(eav_attributes, '$.status') = 1;
View Characteristics
- NOT materialized - Data is queried live from base tables
- NOT indexed - Uses base table indexes via entity_id
- CTE overhead - 5 subqueries per entity type
- JSON aggregation - Processing cost on SELECT
Recommendation: Use for ad-hoc debugging queries, not high-frequency production queries.
Uninstallation
bin/magento module:uninstall MageOS_EavDebugViews --remove-data
This command:
- Drops all module views from the database
- Removes module from
setup_moduletable - Removes module code (if installed via composer)
Use Cases
Quick Product Debugging
-- See all attributes for a specific product SELECT entity_id, sku, JSON_PRETTY(eav_attributes) FROM dev_product WHERE sku = 'problematic-sku';
Find Products with Specific Attribute Values
-- Find disabled products SELECT entity_id, sku, JSON_EXTRACT(eav_attributes, '$.status') as status FROM dev_product HAVING status = 2;
Attribute Discovery
-- What custom attributes exist for products? SELECT attribute_code, frontend_input, is_required FROM dev_product_attribute WHERE is_user_defined = 1;
Category Hierarchy Analysis
-- View category tree with names SELECT entity_id, level, path, JSON_EXTRACT(eav_attributes, '$.name') as name, JSON_EXTRACT(eav_attributes, '$.is_active') as active FROM dev_category WHERE level BETWEEN 1 AND 3 ORDER BY path;
License
Open Software License (OSL-3.0)
Contributing
Issues and pull requests welcome on GitHub.
Support
This is a community-maintained developer utility. No support or warranty implied. Use at your own risk.
For bugs or feature requests, please open an issue in the GitHub repository.
mage-os/module-eav-debug-views 适用场景与选型建议
mage-os/module-eav-debug-views 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 31 次下载、GitHub Stars 达 7, 最近一次更新时间为 2025 年 12 月 02 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「debug」 「eav」 「dev」 「magento2」 「magento 2」 「Database views」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 mage-os/module-eav-debug-views 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 mage-os/module-eav-debug-views 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 mage-os/module-eav-debug-views 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Debug your SimpleBus EventBus and CommandBus
nice output for debug functions for PHP 5.3
Monolog bridge for PHP Debugbar
EAV modeling package for Eloquent and Laravel.
Simple and fast methods to read private properties and call private methods
Analysis module for finding problematical shop data.
统计信息
- 总下载量: 31
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 7
- 点击次数: 36
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: AFL-3.0
- 更新时间: 2025-12-02