Skip to content

Add hardDelete option for softDeleteable fields #68

@downace

Description

@downace

Looks like hardDelete feature can't be enabled when using Fluent. At least I can't find some obvious or documented way.

The SoftDeleteableListener only considers hardDelete as enabled if it's explicitly specified in config, and the is no such option in SoftDeleteable::build method.

Workaround I'm currently using:

$builder->dateTime('deletedAt')->nullable();
$builder->entity()->getClassMetadata()->addExtension(\Gedmo\SoftDeleteable\Mapping\Driver\Fluent::EXTENSION_NAME, [
    'softDeleteable' => true,
    'fieldName'      => 'deletedAt',
    'hardDelete'     => true,
    'timeAware'      => false,
]);

It would be nice to have a fluent method like timeAware:

$builder->softDelete('deletedAt')->hardDelete();
// or
$builder->softDelete('deletedAt')->hardDelete(true);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions