update, delete entity relations
This commit is contained in:
@ -93,6 +93,10 @@ class PostController extends AdminController
|
||||
$postForm->load($_REQUEST);
|
||||
if ($postForm->validate()) {
|
||||
$post = $this->postService->update($postForm, $post);
|
||||
|
||||
$entityRelation = new EntityRelation();
|
||||
$entityRelation->saveEntityRelation(entity: "post", model: $post, request: new Request());
|
||||
|
||||
if ($post) {
|
||||
$this->redirect("/admin/post/view/" . $post->id);
|
||||
}
|
||||
@ -109,6 +113,10 @@ class PostController extends AdminController
|
||||
if (!$post){
|
||||
throw new Exception(message: "The post not found");
|
||||
}
|
||||
|
||||
$entityRelation = new EntityRelation();
|
||||
$entityRelation->deleteEntityRelation(entity: "post", model: $post);
|
||||
|
||||
$post->delete();
|
||||
$this->redirect("/admin/post/");
|
||||
}
|
||||
|
Reference in New Issue
Block a user