Refactor Forms::restore() to use Doctrine

[MAILPOET-3039]
This commit is contained in:
Rodrigo Primo
2021-04-02 11:23:07 -03:00
committed by Veljko V
parent e054f05222
commit 49f0c054fd
4 changed files with 30 additions and 9 deletions

View File

@@ -37,7 +37,15 @@ class FormsRepository extends Repository {
}
public function trash(FormEntity $form) {
$form->setDeletedAt(Carbon::now());
$this->updateDeletedAt($form, Carbon::now());
}
public function restore(FormEntity $form) {
$this->updateDeletedAt($form, null);
}
private function updateDeletedAt(FormEntity $form, ?Carbon $value) {
$form->setDeletedAt($value);
$this->persist($form);
$this->flush();
}