From 025b56773d85e4ed2aa62f7d202f739f107e885a Mon Sep 17 00:00:00 2001 From: Kamil Kuzminski Date: Thu, 25 Jul 2019 14:32:35 +0200 Subject: [PATCH] Fix the ptable not being preserved when creating language records (#57) --- src/Driver.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/Driver.php b/src/Driver.php index b070b48..2154758 100644 --- a/src/Driver.php +++ b/src/Driver.php @@ -1215,9 +1215,16 @@ protected function loadCurrentLanguageRecord() ->execute($this->intId); $intPid = ($objCurrent->numRows) ? $objCurrent->pid : 0; - $intId = \Database::getInstance()->prepare("INSERT INTO " . $this->strTable . " ({$this->pidColumnName},tstamp,{$this->langColumnName},pid) VALUES (?,?,?,?)") - ->execute($this->intId, time(), $language, $intPid) - ->insertId; + + if ($GLOBALS['TL_DCA'][$this->strTable]['config']['dynamicPtable']) { + $intId = \Database::getInstance()->prepare("INSERT INTO " . $this->strTable . " ({$this->pidColumnName},tstamp,{$this->langColumnName},pid,ptable) VALUES (?,?,?,?,?)") + ->execute($this->intId, time(), $language, $intPid, $this->ptable) + ->insertId; + } else { + $intId = \Database::getInstance()->prepare("INSERT INTO " . $this->strTable . " ({$this->pidColumnName},tstamp,{$this->langColumnName},pid) VALUES (?,?,?,?)") + ->execute($this->intId, time(), $language, $intPid) + ->insertId; + } } else { $intId = \Database::getInstance()->prepare("INSERT INTO " . $this->strTable . " ({$this->pidColumnName},tstamp,{$this->langColumnName}) VALUES (?,?,?)") ->execute($this->intId, time(), $language)