Skip to content

Releases: run-as-root/magento-2-seeder

v1.4.0 — Commerce Faker Provider

Choose a tag to compare

@DavidLambauer DavidLambauer released this 22 Apr 04:38
309bc00

What's new

$faker->productName(), ->productAdjective(), ->productMaterial(), ->product(), ->productDepartment() — FakerJS's commerce module, ported to PHP and registered on every Faker generator this module hands out.

Seeded product names now read Fresh Bronze Chair / Sleek Gold Tuna / Handcrafted Rubber Pizza instead of Dolor Sit Amet. Category names come from the curated upstream department list (Books, Automotive, Jewelery, …) instead of a hardcoded 20-entry list with a lorem suffix.

Installation

composer require runasroot/module-seeder:^1.4
bin/magento setup:upgrade

Fully backward compatible with 1.3.x. No new composer requires. FakerFactory::__construct() gained an optional argument; existing callers work unchanged.

Scope

  • en_US wordlists only in v1 — other locales silently fall back to English.
  • Wordlists ported verbatim from @faker-js/faker (MIT) at commit 9e2c0e391b436f56ff54ad89d02efa9982406389. Attribution in NOTICE; refresh guide in src/Faker/Provider/Data/Commerce/README.md.

See CHANGELOG.md for the full entry.

v1.3.0 — Interactive CLI

Choose a tag to compare

@DavidLambauer DavidLambauer released this 21 Apr 20:04
1a1ca97

Highlights

  • New bin/magento db:seed:make command — interactive scaffolder for seeder files. Eliminates the empty-dev/seeders/ dead-end for new users.
  • Multi-select entity types in the interactive flow with cascade hints (e.g. order — cascades: customer, product, category).
  • Progress rendering for count-based file seeders — no more silent hangs on db:seed with large counts.
  • Spinner for custom SeederInterface implementations, TTY-gated so CI stays clean.

See CHANGELOG.md for the full list.

Install

composer require runasroot/module-seeder:^1.3
bin/magento setup:upgrade

Fully backward compatible with 1.2.x.

v1.2.1

Choose a tag to compare

@DavidLambauer DavidLambauer released this 20 Apr 12:34
6299dce

Fixed

  • db:seed --fresh no longer crashes with "Delete operation is forbidden for current area" on installs that carry sample data (or any non-seeder products/categories). SeedCommand now registers isSecureArea = true alongside the existing adminhtml area code, so category/product cleanup can pass Magento's delete guards from CLI. Registration is skipped when the flag is already set by an outer caller to avoid clobbering.

v1.2.0 — Cart Rules, Wishlists, Newsletter Subscribers

Choose a tag to compare

@DavidLambauer DavidLambauer released this 20 Apr 11:44
87638a0

Added

  • Three new entity types: cart_rule, wishlist, newsletter_subscriber — each with a DataGenerator + EntityHandler pair. Reachable via --generate=cart_rule:N, --generate=wishlist:N, --generate=newsletter_subscriber:N, or the fluent seed('<type>') builder entry.
  • CartRuleDataGenerator — weighted action mix of by_percent (60%) / by_fixed (30%) / free_shipping (10%). Each rule gets one attached manual coupon with code format <PREFIX><amount>-<6 uppercase alnum>, active for all websites + all four default customer groups, expires in 1 year, applies to all carts.
  • WishlistDataGenerator — one wishlist per seeded customer with 1–5 random products. Declares customer:N as dependency so --generate=wishlist:50 auto-seeds 50 customers.
  • NewsletterSubscriberDataGenerator — 50/50 mix of customer-linked subscribers and guest emails. Dedup of linked customers derived from registry state so no leak between runs.
  • CustomerDataGenerator now emits 1–3 addresses per customer (first remains default billing/shipping).
  • Integration smoke test covering all three new types + 23 new handler unit tests (289 total).

Changed

  • EntityHandlerPool / DataGeneratorPool items now wire through \Proxy so bin/magento setup:install doesn't eagerly instantiate EAV-touching handlers before the schema exists.

Fixed

  • ProductHandler resolves the image import dir via DirectoryList::getPath(DirectoryList::MEDIA) instead of getRoot() . '/pub/media/...' — sandboxed installs that remap MEDIA no longer fail PathValidator.

Installation

```bash
composer require runasroot/module-seeder:^1.2
bin/magento setup:upgrade
```

Fully backward compatible with 1.1.x — no public API changes.

Full changelog: https://github.com/run-as-root/magento-2-seeder/blob/main/CHANGELOG.md

v1.1.0 — Seeder facade

Choose a tag to compare

@DavidLambauer DavidLambauer released this 20 Apr 09:47
f3cb7b2

Added

  • Abstract RunAsRoot\Seeder\Seeder base class so class-based seeders skip the EntityHandlerPool boilerplate and extend a typed fluent base.
  • Fluent RunAsRoot\Seeder\SeedBuilder API: $this->orders()->count(50)->with([...])->using($fn)->subtype('bundle')->create(). Per-iteration callbacks receive (int $i, Faker\Generator $faker).
  • examples/FluentOrderSeeder.php demonstrating the new style.

Changed

  • SeedBuilder::create() writes created entity data (including the id returned by the handler) into GeneratedDataRegistry under the base type, matching GenerateRunner semantics. This means later builders within the same run() can reference ids through generators.

Installation

composer require runasroot/module-seeder:^1.1
bin/magento setup:upgrade

Fully backward compatible with 1.0.x — existing implements SeederInterface seeders keep working.

Full changelog: https://github.com/run-as-root/magento-2-seeder/blob/main/CHANGELOG.md

v1.0.0 — First stable release

Choose a tag to compare

@DavidLambauer DavidLambauer released this 19 Apr 09:56
7c23b87

First stable release of runasroot/module-seeder. Laravel-style database seeding for Magento 2 via bin/magento db:seed.

composer require runasroot/module-seeder:^1.0 --dev
bin/magento module:enable RunAsRoot_Seeder
bin/magento setup:upgrade
bin/magento setup:di:compile

Highlights

  • 5 entity handlers: category, product, customer, order, cms
  • 5 product type builders: simple, configurable (3×2 variants), bundle, grouped, downloadable
  • 6 order state transitions: new, holded, canceled, processing (invoice), complete (invoice + ship), closed (invoice + refund)
  • Automatic product reviews: Faker-generated reviews + rating votes attached as Approved so they render on the frontend
  • Smart dependency resolver: --generate=order:1000 auto-pulls customers/products/categories at sensible ratios
  • Even category distribution via least-used-first algorithm — seeded products actually land in seeded categories
  • db:seed:status command prints DB counts of all seeded entity types
  • --fresh, --locale, --seed, --stop-on-error, --only, --exclude flags

Quick taste

# 5 categories, mixed product types, 100 orders with reviews
bin/magento db:seed --generate=category:5,product.simple:30,product.configurable:5,product.bundle:3,product.grouped:3,product.downloadable:3,order:100

Breaking changes

  • EntityHandlerInterface::create(array $data): void: int — custom handlers in consumer projects must return the saved entity primary key. PHP will surface this at class-load with a clear "declaration must be compatible" error.

Full changelog

See CHANGELOG.md for the detailed breakdown of every Added / Changed / Fixed entry including the trail of bug fixes landed during development (customer phone regex, quote store context, invoice-driven state persistence, and the registry id propagation that made seeded categories actually hold products).

Compatibility

  • PHP 8.1, 8.2, 8.3 (CI-verified)
  • Magento 2 / Mage-OS

Contributors