public boolean delete (string|array $table, [string $whereCondition], [array $placeholders], [array $dataTypes]) inherited from Phalcon\Db\Adapter
This method deletes data from a table using custom RBDM SQL syntax, so you can only supply string in a where condition.
Internally, this method uses PDO's execute with placeholders and dataTypes supplied, even though the condition itself is not treated but is taken as is (string).
Pay attention how this method works in Zephir:
if !empty whereCondition {
let sql = "DELETE FROM " . escapedTable . " WHERE " . whereCondition;
} else {
let sql = "DELETE FROM " . escapedTable;
}
This is excerpt from my project:
$whereCondition = "$primaryKey = $this->id";
//Warning! If $whereCondition is string it not escaped.
//But since we're fetching primary key dynamically from the table definition, i.e. not from an user input, this is a safe way to handle it
//Deletes data from a table using custom RBDM SQL syntax
$delete = static::$adapter->delete($table, $whereCondition);
//Returns the number of affected rows by the lastest INSERT/UPDATE/DELETE executed in the database system
return $delete ? static::$adapter->affectedRows() : 0x00;