tseho/doctrine-assigned-identity
Doctrine ORM extension that lets entities use application-assigned identifiers—UUIDs, natural keys, or custom IDs—instead of database auto-increment, while keeping Doctrine's identity map and UnitOfWork working correctly.
Architecture fit. The package is a narrowly scoped test-time utility for Doctrine ORM entities, not a framework-level component. Its job is to bypass Doctrine's ID generation strategy so fixtures and unit tests can set deterministic primary keys directly on entities. That is a meaningful fit for teams running Doctrine-managed domain models (Symfony-style, or Laravel applications that have adopted laravel-doctrine/orm), but it is a poor fit for the default Laravel stack. Laravel's Eloquent already permits mass-assignment of primary keys, so the problem this package solves largely does not exist for Eloquent-based codebases. The relevant architectural question is therefore less "should we adopt this" and more "do we actually run Doctrine in a context where fixture IDs need to be deterministic."
Integration feasibility. Mechanically simple: it is a small MIT-licensed library with no stated infrastructure footprint, and it operates on Doctrine metadata and entity hydration rather than on runtime application code. Integration is limited to require-dev, and there is no production wiring. The absence of a public repository reference in the supplied metadata is the principal feasibility concern — we cannot inspect the implementation, verify Doctrine version constraints, or confirm whether it uses a listener, a DBAL type override, or reflection against entity internals. The latter matters because reflection-based approaches are the most likely to break across Doctrine minor releases.
Technical risk. Low blast radius, moderate unknowns. Because the library would be confined to test dependencies, the worst-case failure is a broken test suite rather than a production incident. The real risks are: (1) silent divergence between test-time ID assignment and production ID generation, producing fixtures that violate assumptions the production code relies on (e.g., auto-increment gaps, UUID format constraints, tenant-prefixed identifiers); (2) abandonment — 10 stars and an unverifiable repository imply a single-maintainer, low-bus-factor project; and (3) version coupling to Doctrine ORM internals, which change across major versions. The 0.15 score is consistent with an experimental or under-maintained package.
Key questions. Does our codebase actually use Doctrine, and in which layer? Which Doctrine ORM versions must we support, and does the package declare compatible constraints? How does it assign identity — reflection, a custom ID generator, or metadata override — and does that interact correctly with associations and cascades? Does it coexist with our fixture tooling (DoctrineFixturesBundle, Alice, or Laravel factories)? What is the maintainer's release cadence, and is the repository publicly reviewable? Are there first-party alternatives — a custom test-only ID generator, or simply making IDs assignable via a setId() method guarded by a test flag — that would remove the dependency entirely?
Stack fit. Conditional. If the platform is Eloquent-first, this package is out of scope and should be rejected on relevance grounds; the equivalent need is met natively. If we maintain Doctrine entities — whether in a Symfony service, a Laravel modular monolith using laravel-doctrine/orm, or a shared domain package consumed by both — the package fits cleanly as a development dependency with no application wiring. The decision should be made per-repository, not as a platform standard.
Migration path. There is effectively nothing to migrate. Adoption is a composer require --dev tseho/doctrine-assigned-identity, followed by touching only the fixture and test classes that need deterministic IDs. Existing tests that rely on generated IDs are unaffected. Rollback is a dependency removal plus reverting the small number of fixture call sites. This is a deliberately reversible, low-commitment decision, which is the right framing for the change advisory.
Compatibility. Two axes must be verified before any code is written: Doctrine ORM version (the package must support whatever major we are pinned to, and we should expect to re-verify on each Doctrine upgrade), and PHP version. Because the library hooks entity identity handling, it is more sensitive to Doctrine majors than a typical utility. Our Doctrine upgrade runbook should include a test-suite green run as the compatibility gate, and we should not adopt it in repositories that are mid-upgrade.
Sequencing. Adopt in one repository first — ideally the one with the largest, most brittle Doctrine fixture suite, so the value is measurable. Validate against a representative slice of tests, confirm that association loading and cascades behave identically to production ID generation, then document the pattern. Only after that should it be considered for other Doctrine repositories. If the initial validation surfaces any ambiguity about how identity is assigned, stop and prefer an in-house test-only ID generator; the dependency is small enough that the build-vs-adopt tradeoff favors building when the package's internals cannot be reviewed.
Maintenance. Minimal ongoing cost — one dev dependency and a small set of call sites — but the maintenance burden sits with an external single-maintainer project rather than with us. The realistic scenario is that the package goes quiet and we eventually fork it or replace it with an in-house generator. Budget for that eventuality rather than assuming continuous upstream support.
Support. No commercial support, no visible issue tracker from the supplied metadata, and a very small user base means community answers will be scarce. Internal documentation will be the primary support artifact: what the package does, why it exists in our test suite, and what to do when it breaks. That document is cheap to write now and expensive to reconstruct after the maintainer disappears.
Scaling. Scales trivially along the test-suite dimension, since it is per-test overhead only and does not touch production throughput, request paths, or data stores. It does not scale as an organizational standard: mandating a niche dependency across many repositories increases aggregate maintenance exposure for a benefit that only Doctrine-based test suites realize.
Failure modes. Three to watch. First, silent semantic drift — tests pass with hand-assigned IDs that production would never generate, masking ordering, sequence, or format assumptions. Mitigate by keeping at least one integration test path on the real generation strategy. Second, Doctrine upgrade breakage surfacing as fixture errors, which is noisy but caught immediately by CI. Third, upstream abandonment, which is a slow-burn risk mitigated by the fact that the code surface we depend on is tiny and forkable.
Ramp-up. Very low. A developer familiar with Doctrine fixtures needs perhaps an hour to read the library's surface and apply it to an existing suite; the conceptual model — "override the identity for test data" — requires no new mental model. The larger ramp-up cost is contextual, not technical: ensuring engineers understand when deterministic IDs are appropriate and when they conceal a production behavior they should be exercising instead. That guidance belongs in the team's testing standards, not in the package documentation.
How can I help you explore Laravel packages today?