Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hardDelete option for softDeleteable fields #68

Open
downace opened this issue Feb 8, 2021 · 0 comments
Open

Add hardDelete option for softDeleteable fields #68

downace opened this issue Feb 8, 2021 · 0 comments

Comments

@downace
Copy link

downace commented Feb 8, 2021

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);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant