Refactor Forms::delete() to use Doctrine

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

View File

@ -303,10 +303,10 @@ class Forms extends APIEndpoint {
}
public function delete($data = []) {
$id = (isset($data['id']) ? (int)$data['id'] : false);
$form = Form::findOne($id);
if ($form instanceof Form) {
$form->delete();
$form = $this->getForm($data);
if ($form instanceof FormEntity) {
$this->formsRepository->delete($form);
return $this->successResponse(null, ['count' => 1]);
} else {