Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Soft Deleteable Extension Bundle

Soft Deleteable Extension Bundle Laravel Package

evence/soft-deleteable-extension-bundle

Symfony bundle that extends Gedmo's SoftDeleteable listener, adding onSoftDelete annotations to entity associations. Supports CASCADE, SET NULL, and SUCCESSOR behaviors so references are handled cleanly when a parent is soft-deleted, avoiding Doctrine errors.

View on GitHub
Deep Wiki
Context7

Extensions to softDeleteable listener

Frequently asked questions about Soft Deleteable Extension Bundle
Does evence/soft-deleteable-extension-bundle work with Laravel?
No. It is a Symfony bundle built on top of Gedmo's Doctrine SoftDeleteable listener for the Doctrine ORM; there is no Laravel service provider, no Eloquent hook and no Laravel package manifest. Laravel applications on Eloquent already get soft deletes and can handle cascade, nulling and reassignment through model events and observers. Only consider it if your Laravel app uses laravel-doctrine/orm with Gedmo already in production.
How do I install and register the bundle?
Install it with composer require evence/soft-deleteable-extension-bundle, then register EvenceSoftDeleteableExtensionBundle in your Symfony kernel bundle list (app/AppKernel.php in older Symfony, config/bundles.php in Symfony 4+). You must already have Doctrine ORM and Gedmo's SoftDeleteable extension configured, because this bundle only extends that listener rather than providing it. After registration you annotate the owning side of an association with onSoftDelete and choose a type. No schema migration or backfill is required.
What does the onSoftDelete annotation actually do?
It adds SQL ON DELETE style behaviour to a Doctrine association when the parent entity is soft-deleted. Gedmo's SoftDeleteable sets a deletedAt timestamp instead of issuing a real DELETE, so database-level ON DELETE rules never fire and child references are left pointing at logically removed rows. This bundle hooks the soft delete event and applies the declared action to the associated records. The result is that you avoid dangling references and the Doctrine proxy hydration errors that follow them.
What is the difference between CASCADE, SET NULL and SUCCESSOR?
CASCADE soft-deletes the associated entity when its parent is soft-deleted, for example archiving a shop also archives its listings. SET NULL clears the owning reference while keeping the child record alive, which models unlinking rather than deletion. SUCCESSOR reassigns the reference to another entity of the same class that you have marked as the successor, which suits merges, plan migrations and ownership transfers.
Why do I get EntityNotFoundException or proxy errors after soft-deleting a parent record?
SoftDeleteable converts a delete into an UPDATE of the deletedAt column, so the row stays in the database and no ON DELETE action runs. Associations still hold foreign keys to that row, and Doctrine later tries to hydrate a proxy for an entity the soft delete filter considers gone. The bundle applies your declared cascade, set-null or successor rule at soft-delete time so references are resolved before they can dangle. This is the gap originally reported in Gedmo issue 505, open since 2012.
Why is SUCCESSOR considered the differentiator of this package?
Cascade and null semantics can be approximated with listeners or model events, but reassigning references to a replacement record has no clean built-in equivalent in Doctrine or Gedmo. SUCCESSOR lets you point children at a surviving entity, which retires the hand-written one-off migration scripts teams write for merges and plan changes. That recurring unbudgeted scripting cost is the main concrete value to point at. Note the successor must be the same entity class as the original target.
Does the bundle support PHP 8 attributes or only docblock annotations?
The README documents only docblock annotations on the owning side of an association and shows no attribute-based equivalent. Doctrine ORM 3 removed the annotation reader, so an annotation-only answer is a hard stop for a modern Doctrine stack. Confirm attribute support explicitly with the maintainer or a spike before committing scope. Do not assume parity just because the package is installable.
Which Doctrine ORM, DBAL, Gedmo and PHP versions are supported?
The README does not state a compatibility envelope, and there is no visible CI matrix covering PHP, Doctrine ORM, DBAL or Gedmo versions. Because the package extends Gedmo's listener, its supported range is tightly coupled to Gedmo's event signatures and UnitOfWork behaviour. Treat version support as unverified and pin your dependencies explicitly. Test upgrades of Gedmo against your delete paths before bumping.
Is this package safe to use in production and is it actively maintained?
It has roughly 57 stars and effectively no dependents, so there is little evidence of battle testing in the wild. The recent October 2024 release signals liveness rather than long-term durability. Treat it as adopt-and-own rather than adopt-and-depend, and check whether a named maintainer with commit rights exists. Delete paths are rarely well covered by tests, so add coverage around soft deletes before you rely on it.
What edge cases and alternatives should I check before adopting it?
Ask whether the listener wraps cascades in a transaction, whether recursive cascades and cyclic associations are guarded against, and whether SUCCESSOR chains are handled. Confirm which association types are covered (ManyToOne only, or also OneToOne and ManyToMany) and whether bulk DQL deletes and programmatic remove() are hooked as well as preSoftDelete. The alternative is a custom Doctrine event subscriber or, in Laravel, Eloquent model events, both of which you own end to end. For Symfony plus Doctrine plus Gedmo stacks where referential integrity after soft deletes is a real incident source, evaluating this bundle is reasonable.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
elmogy/larafast
xeviant/laravel-paystack
gorilladash/laravel-website-sdk
martialbe/flysystem-oss
chondal/3312client
jeroen-g/flickr
opscale-co/nova-genbi
itsjustvita/laravel-retention
tequilarapido/trackit
gregsphotography/site-builder-filament
cabaoctavio/laravel-query-log
gregsphotography/site-builder-components
io-digital/clickatell
snowsoft/laravel-admin
oxygen/auth
relicsoftware/barakah-payment-gateway
tobya/work-with-composer
equipc/laravel-email-validator
equipc/laravel-email-database-log
adedsec/nova-translated-labels