Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Commit

Permalink
Unset the primary key if a model is deleted (see #6162)
Browse files Browse the repository at this point in the history
  • Loading branch information
leofeyer committed Sep 16, 2013
1 parent 7607d1d commit dc2820f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions contao/library/Contao/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -334,9 +334,12 @@ protected function postSave($intType)
*/
public function delete()
{
return \Database::getInstance()->prepare("DELETE FROM " . static::$strTable . " WHERE " . static::$strPk . "=?")
->execute($this->{static::$strPk})
->affectedRows;
$intAffected = \Database::getInstance()->prepare("DELETE FROM " . static::$strTable . " WHERE " . static::$strPk . "=?")
->execute($this->{static::$strPk})
->affectedRows;

$this->arrData[static::$strPk] = null; // see #6162
return $intAffected;
}


Expand Down

0 comments on commit dc2820f

Please sign in to comment.