commit bde24e81c38e3a953892faa6288598885d4efdc0 parent c823dab3ab672c329480a266702486d32e1ea6b9 Author: dankert <openrat@jandankert.de> Date: Sun, 10 Apr 2022 12:10:24 +0200 Fix: Pagecontent must be created if the value of a pageelement is stored for the first time. Diffstat:
M | modules/cms/action/page/PageAllAction.class.php | | | 1 | + |
M | modules/cms/action/pageelement/PageelementAllAction.class.php | | | 1 | + |
M | modules/cms/model/PageContent.class.php | | | 2 | +- |
3 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/modules/cms/action/page/PageAllAction.class.php b/modules/cms/action/page/PageAllAction.class.php @@ -207,6 +207,7 @@ class PageAllAction extends PageAction implements Method { $pageContent->pageId = $this->page->pageid; $pageContent->languageid = $languageid; $pageContent->load(); + $pageContent->persist(); // Create if it does not exist yet. $value = new Value(); $value->contentid = $pageContent->contentId; diff --git a/modules/cms/action/pageelement/PageelementAllAction.class.php b/modules/cms/action/pageelement/PageelementAllAction.class.php @@ -208,6 +208,7 @@ class PageelementAllAction extends PageelementAction implements Method { $pageContent->pageId = $this->page->pageid; $pageContent->languageid = $languageid; $pageContent->load(); + $pageContent->persist(); // Create the content if it does not exist yet. $value = new Value(); $value->contentid = $pageContent->contentId; diff --git a/modules/cms/model/PageContent.class.php b/modules/cms/model/PageContent.class.php @@ -104,7 +104,7 @@ SQL /** * Add new object. */ - public function add() + protected function add() { // Get next ID from database. $stmt = DB::sql('SELECT MAX(id) FROM {{pagecontent}}');