core-bundle/src/Resources/contao/library/Contao/Model.php
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 " . Database::quoteIdentifier(static::$strPk) . "=?")
											   ->execute($intPk)
											   ->affectedRows;

		if ($intAffected)
		{
			// Unregister the model
			Registry::getInstance()->unregister($this);

			// Remove the primary key (see #6162)
			$this->arrData[static::$strPk] = null;
		}

		return $intAffected;
	}
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 " . Database::quoteIdentifier(static::$strPk) . "=?")
											   ->execute($intPk)
											   ->affectedRows;

		if ($intAffected)
		{
			// Unregister the model
			Registry::getInstance()->unregister($this);

			// Remove the primary key (see #6162)
			$this->arrData[static::$strPk] = null;
		}

		return $intAffected;
	}
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 " . Database :: quoteIdentifier ( static :: $ strPk ) . "=?" ) -> execute ( $ intPk ) -> affectedRows ; if ( $ intAffected ) { // Unregister the model Registry :: getInstance ( ) -> unregister ( $ this ) ; // Remove the primary key (see #6162) $ this -> arrData [ static :: $ strPk ] = null ; } return $ intAffected ; }
Delete the current record and return the number of affected rows

@return integer The number of affected rows
Delete the current record and return the number of affected rows