Skip to content

Commit 7398ca1

Browse files
committed
Fix soft delete in future
Lookup interface instead of DateTime.
1 parent d5fdc57 commit 7398ca1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/Gedmo/SoftDeleteable/SoftDeleteableListener.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ public function onFlush(EventArgs $args)
6363
if (isset($config['softDeleteable']) && $config['softDeleteable']) {
6464
$reflProp = $meta->getReflectionProperty($config['fieldName']);
6565
$oldValue = $reflProp->getValue($object);
66-
67-
if (isset($config['hardDelete']) && $config['hardDelete'] && $oldValue instanceof \Datetime) {
66+
$date = new \DateTime();
67+
if (isset($config['hardDelete']) && $config['hardDelete'] && $oldValue instanceof \DateTimeInterface && $oldValue <= $date) {
6868
continue; // want to hard delete
6969
}
7070

@@ -73,7 +73,7 @@ public function onFlush(EventArgs $args)
7373
$ea->createLifecycleEventArgsInstance($object, $om)
7474
);
7575

76-
$date = new \DateTime();
76+
7777
$reflProp->setValue($object, $date);
7878

7979
$om->persist($object);

0 commit comments

Comments
 (0)