Skip to content

Commit

Permalink
Do not create new DC objects in the reviseTable() method
Browse files Browse the repository at this point in the history
  • Loading branch information
leofeyer committed May 13, 2019
1 parent ba1e039 commit c973308
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions core-bundle/src/Resources/contao/drivers/DC_Table.php
Expand Up @@ -3320,25 +3320,27 @@ protected function reviseTable()
// Remove the entries from the database
if (!empty($new_records[$this->strTable]))
{
$origId = $this->id;
$origActiveRecord = $this->activeRecord;
$ids = array_map('\intval', $new_records[$this->strTable]);

foreach ($ids as $id)
{
$dataContainer = static::class;
$dc = new $dataContainer($this->strTable);
$dc->id = $id;

// Get the current record
$objRow = $this->Database->prepare("SELECT * FROM " . $this->strTable . " WHERE id=?")
->limit(1)
->execute($id);

$dc->activeRecord = $objRow;
$this->id = $id;
$this->activeRecord = $objRow;

// Invalidate cache tags (no need to invalidate the parent)
$this->invalidateCacheTags($dc);
$this->invalidateCacheTags($this);
}

$this->id = $origId;
$this->activeRecord = $origActiveRecord;

$objStmt = $this->Database->execute("DELETE FROM " . $this->strTable . " WHERE id IN(" . implode(',', $ids) . ") AND tstamp=0");

if ($objStmt->affectedRows > 0)
Expand Down

0 comments on commit c973308

Please sign in to comment.