entity relation save

This commit is contained in:
2024-11-21 13:00:21 +03:00
parent 860ea1a82d
commit 62eff81213
5 changed files with 90 additions and 1 deletions

View File

@ -6,9 +6,12 @@ namespace kernel\modules\post\controllers;
use Exception;
use JetBrains\PhpStorm\NoReturn;
use kernel\AdminController;
use kernel\EntityRelation;
use kernel\helpers\Debug;
use kernel\modules\post\models\forms\CreatePostForm;
use kernel\modules\post\models\Post;
use kernel\modules\post\service\PostService;
use kernel\Request;
class PostController extends AdminController
{
@ -31,6 +34,10 @@ class PostController extends AdminController
$postForm->load($_REQUEST);
if ($postForm->validate()) {
$post = $this->postService->create($postForm);
$entityRelation = new EntityRelation();
$entityRelation->saveEntityRelation("post", new Request());
if ($post) {
$this->redirect("/admin/post/view/" . $post->id);
}