src/SnooPHP/Model/Model.php
public function delete()
	{
		// Table informations
		$tableName	= static::tableName();
		$columns	= static::tableColumns();
		$idColumn	= static::$idColumn;
		
		// Use id column if possible
		if (isset($this->$idColumn))
		{
			$status = Db::query("
				delete from $tableName
				where $idColumn = :id
			", ["id" => $this->$idColumn], static::getDbName(), false);
		}
		else
		{
			$condition	= "";
			$params		= [];
			foreach ($columns as $column)
			{
				$name	= $column["column_name"];
				$key	= $column["column_key"];
				if (isset($this->$name))
				{
					$condition .= "$name = :$name and ";
					$params[$name] = $this->encodeValue($name);
				}
			}
			$condition = substr($condition, 0, -5);

			var_dump("
				delete from $tableName
				where $condition
			");
			var_dump($params);

			$status = Db::query("
				delete from $tableName
				where $condition
			", $params, static::getDbName(), false);
		}

		return $status !== false && $status > 0;
	}
public function delete()
	{
		// Table informations
		$tableName	= static::tableName();
		$columns	= static::tableColumns();
		$idColumn	= static::$idColumn;
		
		// Use id column if possible
		if (isset($this->$idColumn))
		{
			$status = Db::query("
				delete from $tableName
				where $idColumn = :id
			", ["id" => $this->$idColumn], static::getDbName(), false);
		}
		else
		{
			$condition	= "";
			$params		= [];
			foreach ($columns as $column)
			{
				$name	= $column["column_name"];
				$key	= $column["column_key"];
				if (isset($this->$name))
				{
					$condition .= "$name = :$name and ";
					$params[$name] = $this->encodeValue($name);
				}
			}
			$condition = substr($condition, 0, -5);

			var_dump("
				delete from $tableName
				where $condition
			");
			var_dump($params);

			$status = Db::query("
				delete from $tableName
				where $condition
			", $params, static::getDbName(), false);
		}

		return $status !== false && $status > 0;
	}
public function delete ( ) { // Table informations
 $ tableName = static :: tableName ( ) ; $ columns = static :: tableColumns ( ) ; $ idColumn = static :: $ idColumn ; // Use id column if possible
 if ( isset ( $ this -> $ idColumn ) ) { $ status = Db :: query ( "
				delete from $tableName
				where $idColumn = :id
			" , [ "id" => $ this -> $ idColumn ] , static :: getDbName ( ) , false ) ; } else { $ condition = "" ; $ params = [ ] ; foreach ( $ columns as $ column ) { $ name = $ column [ "column_name" ] ; $ key = $ column [ "column_key" ] ; if ( isset ( $ this -> $ name ) ) { $ condition .= "$name = :$name and " ; $ params [ $ name ] = $ this -> encodeValue ( $ name ) ; } } $ condition = substr ( $ condition , 0 , - 5 ) ; var_dump ( "
				delete from $tableName
				where $condition
			" ) ; var_dump ( $ params ) ; $ status = Db :: query ( "
				delete from $tableName
				where $condition
			" , $ params , static :: getDbName ( ) , false ) ; } return $ status !== false && $ status > 0 ; }
Delete this model from table

@return bool
Delete this model from table