webonaute/doctrine-datalocking-bundle
A Symfony bundle that brings data locking to Doctrine entities, helping prevent concurrent modification conflicts and keeping persistence safe with minimal configuration.
Consider the pattern (not necessarily this package) when:
SELECT … FOR UPDATE-style contention is not the bottleneck.Look elsewhere — or treat this as reference material only — because:
DoctrineDataLockingBundle) built on Doctrine ORM/DBAL and the Symfony container. Adopting it in Laravel means pulling in Doctrine plus Symfony bundle wiring, or lifting the logic out. In Laravel, the native equivalents are Cache::lock(), withoutOverlapping(), and lockForUpdate() / skip locked on the query builder — cheaper and already supported.SKIP LOCKED-based queues or a broker scale better.Recommended posture: do not take a production dependency on the package. Use it as a design reference — read the schema and claiming logic, then implement the equivalent in-house (~a few hundred lines: a lock_id, locked_at, locked_by column set plus a token table) or use the platform-native locking primitives. That removes the supply-chain risk while keeping the product benefit.
To executives: The problem this solves is real and expensive — two workers picking up the same record and charging a customer twice, or sending the same statement email twice. The specific package is not the recommendation: it's a small, unmaintained Symfony component with essentially no adoption, so committing to it would trade a correctness risk for a maintenance risk. The right move is to adopt the pattern — atomically claiming a batch of records with a token before processing — using primitives we already run, and to make the associated product decisions explicit: how long a claim lives, what happens when a worker dies, and which operations must be idempotent. Effort is on the order of one sprint, and it closes a class of duplicate-processing incidents rather than a single bug.
To engineering: Treat webonaute/doctrine-datalocking-bundle as a reference implementation, not a dependency. It requires Doctrine + Symfony bundle wiring, has had no release since May 2022, and has no downstream users — we'd own Doctrine/Symfony version drift ourselves. The mechanism worth copying is the claim-token table: a single UPDATE … WHERE locked_at IS NULL setting a generated lock_id, with processors filtering on that token, and a reaper for stale claims. In Laravel we get most of this from Cache::lock() plus a locked_at/locked_by pair on the entity, or lockForUpdate() for short critical sections. If we later find we need retries, backoff, and dead-letter handling, that's the signal to move the workload onto the queue rather than extend the lock table — please flag contention or stuck-claim metrics as the trigger.
How can I help you explore Laravel packages today?