[PLUGIN][AttachmentCollections] Fixing forms submission

This commit is contained in:
Phablulo Joel 2021-12-27 15:25:20 -03:00
parent 72a19d7eac
commit 672df5165c
2 changed files with 7 additions and 0 deletions

View File

@ -33,6 +33,7 @@ namespace Plugin\AttachmentCollections;
use App\Core\DB\DB; use App\Core\DB\DB;
use App\Core\Event; use App\Core\Event;
use App\Core\Exception\RedirectException;
use App\Core\Form; use App\Core\Form;
use function App\Core\I18n\_m; use function App\Core\I18n\_m;
use App\Core\Modules\Plugin; use App\Core\Modules\Plugin;
@ -172,6 +173,7 @@ class AttachmentCollections extends Plugin
} }
} }
DB::flush(); DB::flush();
throw new RedirectException();
} }
// add to new collection form // add to new collection form
$create_form = Form::create([ $create_form = Form::create([
@ -204,6 +206,7 @@ class AttachmentCollections extends Plugin
'collection_id' => $coll->getId(), 'collection_id' => $coll->getId(),
])); ]));
DB::flush(); DB::flush();
throw new RedirectException();
} }
$res[] = Formatting::twigRenderFile( $res[] = Formatting::twigRenderFile(

View File

@ -24,6 +24,7 @@ declare(strict_types = 1);
namespace Plugin\AttachmentCollections\Controller; namespace Plugin\AttachmentCollections\Controller;
use App\Core\DB\DB; use App\Core\DB\DB;
use App\Core\Exception\RedirectException;
use App\Core\Form; use App\Core\Form;
use function App\Core\I18n\_m; use function App\Core\I18n\_m;
use App\Core\Router\Router; use App\Core\Router\Router;
@ -86,6 +87,7 @@ class Controller extends FeedController
'actor_id' => $id, 'actor_id' => $id,
])); ]));
DB::flush(); DB::flush();
throw new RedirectException();
} }
} }
@ -150,6 +152,7 @@ class Controller extends FeedController
$collection->setName($edit->getData()['name']); $collection->setName($edit->getData()['name']);
DB::persist($collection); DB::persist($collection);
DB::flush(); DB::flush();
throw new RedirectException();
} }
return $edit->createView(); return $edit->createView();
} }
@ -169,6 +172,7 @@ class Controller extends FeedController
if ($rm->isSubmitted()) { if ($rm->isSubmitted()) {
DB::remove($collection); DB::remove($collection);
DB::flush(); DB::flush();
throw new RedirectException();
} }
return $rm->createView(); return $rm->createView();
} }