yii\db\QueryBuilder::delete PHP Méthode

delete() public méthode

For example, php $sql = $queryBuilder->delete('user', 'status = 0'); The method will properly escape the table and column names.
public delete ( string $table, array | string $condition, array &$params ) : string
$table string the table where the data will be deleted from.
$condition array | string the condition that will be put in the WHERE part. Please refer to [[Query::where()]] on how to specify condition.
$params array the binding parameters that will be modified by this method so that they can be bound to the DB command later.
Résultat string the DELETE SQL
    public function delete($table, $condition, &$params)
    {
        $sql = 'DELETE FROM ' . $this->db->quoteTableName($table);
        $where = $this->buildWhere($condition, $params);
        return $where === '' ? $sql : $sql . ' ' . $where;
    }