Download the PHP package stichtingsd/soft-deleteable-extension-bundle without Composer
On this page you can find all versions of the php package stichtingsd/soft-deleteable-extension-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download stichtingsd/soft-deleteable-extension-bundle
More information about stichtingsd/soft-deleteable-extension-bundle
Files in stichtingsd/soft-deleteable-extension-bundle
Package soft-deleteable-extension-bundle
Short Description Extension to Gedmo Softdeleteable.
License MIT
Informations about the package soft-deleteable-extension-bundle
SoftDeleteableExtensionBundle
Warning: This bundle only works with Symfony ^6.0 and PHP ^8.1
This bundle is created to handle soft deletes for associated entities/documents in addition to the functionality of Gedmo SoftDelete. Gedmo does not handle CASCADING relations for example. Doctrine doesn't also since it's not actually deleted.
The bundle also handles deletion of large entities very well thanks to Doctrine DQL and Proxy objects. Entities that have 10.000+ relations are updated in a split second.
Prerequisites
This bundle requires Symfony ^6.1 or higher and PHP ^8.1 or higher
- Symfony ^6.0
- PHP ^8.1
- doctrine/doctrine-extensions ^2.0 | ^3.0 (Gedmo)
Installation
Add stichtingsd/soft-deleteable-extension-bundle to your composer.json
file:
Bundle registration (Skip when using Symfony Flex)
Register bundle into config/bundles.php (Flex did it automatically):
Getting started
Cascade soft deletedelete the entity
To (soft-)delete an entity when its parent record is soft-deleted:
Set reference to null (instead of deleting the entity)
Supported association types:
- One-To-One
- Type::CASCADE
- Type::SET_NULL
- Many-To-One
- Type::CASCADE
- Type::SET_NULL
- Many-To-Many
- Type::REMOVE_ASSOCIATION_ONLY
Type::CASCADE
This behaves like the SQL CASCADE. All relations that have a soft deleteable field from Gedmo will be deleted also.
Type::SET_NULL
This behaves like the SQL SET_NULL. The relation will be set to NULL.
Caution: Your field must be nullable: true
to allow null values.
Type::REMOVE_ASSOCIATION_ONLY
This will remove the association only. Associated entities them self are not deleted since they can have other associations.
Full example Many-To-One
Full example Many-To-Many (mapped side)
Full example Many-To-Many (inversed side)
Limitations
Many-To-Many
- Currently, it's only possible to use the
Type::REMOVE_ASSOCIATION_ONLY
.One-To-Many
- Not supported, and won't be. Define it on the Many-To-One side.
All versions of soft-deleteable-extension-bundle with dependencies
doctrine/common Version ^2.13 || ^3.0
doctrine/doctrine-bundle Version ^2.7
doctrine/orm Version ^2.7
gedmo/doctrine-extensions Version ^3.4
symfony/framework-bundle Version ^6.1
symfony/property-access Version ^6.1