我目前正在为Mautic制作插件,并且被困在如何将表单提交到数据库中后将其删除。是否可以使用提交ID或提交实体从表单中删除特定表单提交?
这是我尝试过的方法,但是没有用。
// Attempt 1
public function onFormSubmitAction(SubmissionEvent $event)
{
$submissionModel = $factory->getModel('form.submission');
$submission = $event->getSubmission();
$submissionModel->deleteEntity($submission);
}
// Attempt 2
public function onFormSubmitAction(SubmissionEvent $event)
{
$form = $event->getForm();
$submission = $event->getSubmission();
$form->removeSubmission($submission);
}