Skip to content

Commit

Permalink
Also check the ptable in the SQL query
Browse files Browse the repository at this point in the history
  • Loading branch information
leofeyer committed Feb 2, 2024
1 parent a28ebb9 commit ef335ed
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions core-bundle/contao/library/Contao/Controller.php
Expand Up @@ -1282,11 +1282,20 @@ protected function getParentEntries($strTable, $intId)

do
{
$dynamicWhere = '';
$values = array($intId);

if ($GLOBALS['TL_DCA'][$strParentTable]['config']['dynamicPtable'])
{
$dynamicWhere = ' AND ptable=?';
$values[] = $strParentTable;
}

// Get the pid
$objParent = $db
->prepare("SELECT pid FROM " . $strParentTable . " WHERE id=?")
->prepare("SELECT pid FROM " . $strParentTable . " WHERE id=?$dynamicWhere")
->limit(1)
->execute($intId);
->execute(...$values);

if ($objParent->numRows < 1)
{
Expand Down

0 comments on commit ef335ed

Please sign in to comment.