public function delete()
{
$intPk = $this->{static::$strPk};
// Track primary key changes
if (isset($this->arrModified[static::$strPk])) {
$intPk = $this->arrModified[static::$strPk];
}
// Delete the row
$intAffected = \Database::getInstance()->prepare("DELETE FROM " . static::$strTable . " WHERE " . static::$strPk . "=?")->execute($intPk)->affectedRows;
if ($intAffected) {
// Unregister the model
\Model\Registry::getInstance()->unregister($this);
// Remove the primary key (see #6162)
$this->arrData[static::$strPk] = null;
}
return $intAffected;
}