Generate Synthetic Test Data for Magento 2 EAV Schemas
The only synthetic data generator combining industry standards for research, clinical operations, and pharmaceutical testing
If you develop on Magento 2, you already know the pain of database seeding.
Spinning up a local testing environment or populating a staging server with mock data should be easy. But Magento relies heavily on an Entity-Attribute-Value (EAV) architecture. While this structure provides incredible flexibility for e-commerce catalogs, it turns generating dummy products and realistic synthetic test data into a nightmare of foreign key violations and broken frontend pages.
Here is a breakdown of why Magento 2 EAV breaks standard mocking tools, and how you can use Aphelion to generate thousands of realistic, constraint-safe products and orders in seconds.
The Code Problem: Why EAV is Hard to Mock
In a standard relational database, a "Product" table has simple columns for name, price, and description.
Magento 2 doesn't do that. Instead, it uses an abstract EAV model where data is scattered across multiple backend tables based on its data type. To understand why generic tools fail, look at what a single Magento 2 product's price looks like at the database level. It is not a single column; it is a fragmented relationship:
-- 1. The Core Product Entity CREATE TABLE catalog_product_entity ( entity_id INT AUTO_INCREMENT PRIMARY KEY, sku VARCHAR(64) UNIQUE, created_at TIMESTAMP ); -- 2. The Attribute Definition (e.g., Tells us ID 77 is "Price") CREATE TABLE eav_attribute ( attribute_id INT AUTO_INCREMENT PRIMARY KEY, attribute_code VARCHAR(255), backend_type VARCHAR(255) -- e.g., 'decimal' ); -- 3. The Value Storage (Where the actual $9.99 lives) CREATE TABLE catalog_product_entity_decimal ( value_id INT AUTO_INCREMENT PRIMARY KEY, attribute_id INT, -- Must exactly match the ID for 'price' entity_id INT, -- Must exactly match the product value DECIMAL(12,4), FOREIGN KEY (attribute_id) REFERENCES eav_attribute(attribute_id), FOREIGN KEY (entity_id) REFERENCES catalog_product_entity(entity_id) );
Why Faker.js and Custom Scripts Fail
If you point a generic tool like Faker.js or a basic SQL seed script at this schema, it will fail for two critical reasons:
- Abstract Data Types: A generic generator sees the value column in catalog_product_entity_decimal and doesn't know what it is filling. It might generate a random decimal of 0.0001 for a product's weight, and 5000.00 for a product's price, and assign them to the wrong attribute_id. Your database won't throw an error, but your Magento frontend will be completely broken with \$0.0001 products.
- Foreign Key Hell: Magento 2 has over 400 tables with deeply nested, and sometimes circular, foreign key dependencies. Generic tools insert data in alphabetical or random order, instantly triggering FK violations.
The Aphelion Solution
Aphelion is a high-performance, Rust-native synthetic data generator designed specifically to handle complex relational structures like EAV. Instead of requiring manual configuration, Aphelion automatically introspects the Magento 2 schema. It builds a topological dependency graph to guarantee zero foreign key violations, and it maps Magento's internal EAV attributes to realistic data generators (e.g., matching price attributes to realistic currency generation).
Recipe: Seeding a Magento 2 Catalog
Here is how to generate 10,000 realistic dummy products and their associated EAV records using the Aphelion CLI in just two steps.
Step 1: Introspect the Schema
First, point Aphelion at your empty (or partially filled) Magento 2 database. Aphelion will automatically map the 400+ tables and resolve the correct insertion order.
aphelion introspect mysql://admin:password@localhost:3306/magento_staging Output: > Connected to database 'magento_staging' > Found 412 tables > Detected EAV patterns in catalog_product_entity... > Generating schema map... Done.
Step 2: Generate the Data
Next, command Aphelion to generate the data. By using the --seed flag, you ensure the generation is deterministic—meaning if you run this same command tomorrow, it will generate the exact same catalog of products. This is critical for reproducing bugs in CI/CD pipelines.
aphelion generate --table catalog_product_entity --rows 10000 --seed 2026 Output: > Generating data plan... > Phase 1: Resolving eav_attribute definitions... > Phase 2: Generating catalog_product_entity (10,000 rows)... > Phase 3: Populating entity_varchar, entity_decimal, entity_int... > Phase 4: Validating Foreign Keys... > Successfully generated 85,000 rows across 12 tables in 3.4s. 0 FK Violations.
Step 3: Verify the Data
Log into your Magento 2 admin panel or query the database directly. You will find 10,000 new mock products with properly mapped names, SKUs, and prices, entirely free of PII (Personally Identifiable Information) and perfectly safe for testing.
Stop Fighting Your Schema
You shouldn't have to write hundreds of lines of complex Common Table Expressions (CTEs) just to seed a staging environment.
Aphelion runs locally on your machine, requires zero configuration, and generates constraint-safe data at 10,000+ rows per second. Download the free Aphelion CLI for Linux (x64) here and seed your Magento 2 environment in under five minutes.
Tags: #Healthcare #OMOP #OpenMRS #SyntheticData #FHIR #HIPAA #DataGeneration
Ready for Verifiable Synthetic Data?
Discover how CausalFoundry manufactures high-integrity datasets that obey your complex business rules.
Explore CausalFoundry