Skip to content

2.0.0-rc.4

Pre-release
Pre-release

Choose a tag to compare

@dereuromark dereuromark released this 20 May 22:15
· 5 commits to main since this release
8993118

Tip

First time on v2? See the What's new in v2 overview for a single-page tour of the new surface (withRequiredParents, recycle, Story, TableAssertionsTrait, Sequence context, alias overloads on for/has, eager transaction strategy, strictDefinition detector, Bake quality).

Fixes

  • Fix configure()-time withRequiredParents() losing FK-column propagation. Factories whose configure() returns $this->withRequiredParents() — the canonical downstream-consumer form — failed to propagate auto-resolved parents' ids into the child's FK columns, so inserts hit a NOT NULL constraint at persist time. The external-call form (Factory::new()->withRequiredParents()->save()) was unaffected. (#105)
  • Fix three pinned-FK precedence bugs in withRequiredParents():
    • An array-instantiation pin overridden by sequenceField() (Factory::new(['fk' => x])->sequenceField('fk', null, ...)->withRequiredParents()) no longer skips parent composition — getPinnedFields() now drops instantiation pins for fields sequence touches without fully pinning.
    • The additive requiredParentAssociations() hook now honors the pinned-FK skip uniformly with auto-detected aliases, so a caller-pinned FK on a hook-opted required parent (e.g. nullable business_address_id) is no longer silently overridden by a composed fresh parent.
    • The entity-instantiation path (Factory::new($entity)) now also composes the parent when sequence() may overwrite the entity-side FK pin, and the auto-resolved parent no longer gets silently demoted-into-invisibility on entity-injected builds. Documented trade-off: recycle() cannot substitute auto-resolved parents on an entity-injected chain (entity injection + recycle + withRequiredParents simultaneously). (#106)
  • Fix strictDefinition silently exempting shared-primary-key 1:1 belongsTo FKs. The FK-in-definition() detector skipped every primary-key column before checking whether the column was also a belongsTo FK, so children whose id was both PK and FK to their parent (a common 1:1 shape) escaped the dangling-id deprecation. v2 is the last chance to warn those users before the v3 removal of the opt-out. (#108)

Caution

2.0.0-rc.3 carries these regressions. Upgrade to 2.0.0-rc.4 if your factories use configure()-time withRequiredParents(), the requiredParentAssociations() hook with a pinned FK, withRequiredParents() combined with sequence() / sequenceField() on a required FK column, or a shared-primary-key 1:1 belongsTo pattern.

Full Changelog: 2.0.0-rc.3...2.0.0-rc.4