public function delete($where)
    {
        $is_model = is_a($where, $this->model_class);
        if (!$is_model && !is_a($where, Query\WhereClause::class))
            throw new InvalidTypeException("Must provide a WhereClause or an instance of {$this->model_class} to delete");

        $modelInstance = null;
        if ($is_model)
        {
            $database = $where->getSourceDB();
            if ($database === null || $database !== $this->db)
                throw new DAOException("Cannot remove this record - it did not originate in this database");

            $modelInstance = $where;
            $where = $this->getSelector($this->getPrimaryKey(), $modelInstance->getRecord());
        }

        $delete = new Query\Delete($this->tablename, $where);
        $drv = $this->db->getDriver();

        $rows = $drv->delete($delete);
        if ($is_model)
            $modelInstance->destruct();

        return $rows;
    }
public function delete($where)
    {
        $is_model = is_a($where, $this->model_class);
        if (!$is_model && !is_a($where, Query\WhereClause::class))
            throw new InvalidTypeException("Must provide a WhereClause or an instance of {$this->model_class} to delete");

        $modelInstance = null;
        if ($is_model)
        {
            $database = $where->getSourceDB();
            if ($database === null || $database !== $this->db)
                throw new DAOException("Cannot remove this record - it did not originate in this database");

            $modelInstance = $where;
            $where = $this->getSelector($this->getPrimaryKey(), $modelInstance->getRecord());
        }

        $delete = new Query\Delete($this->tablename, $where);
        $drv = $this->db->getDriver();

        $rows = $drv->delete($delete);
        if ($is_model)
            $modelInstance->destruct();

        return $rows;
    }
public function delete ( $ where ) { $ is_model = is_a ( $ where , $ this -> model_class ) ; if ( ! $ is_model && ! is_a ( $ where , Query \ WhereClause :: class ) ) throw new InvalidTypeException ( "Must provide a WhereClause or an instance of {$this->model_class} to delete" ) ; $ modelInstance = null ; if ( $ is_model ) { $ database = $ where -> getSourceDB ( ) ; if ( $ database === null || $ database !== $ this -> db ) throw new DAOException ( "Cannot remove this record - it did not originate in this database" ) ; $ modelInstance = $ where ; $ where = $ this -> getSelector ( $ this -> getPrimaryKey ( ) , $ modelInstance -> getRecord ( ) ) ; } $ delete = new Query \ Delete ( $ this -> tablename , $ where ) ; $ drv = $ this -> db -> getDriver ( ) ; $ rows = $ drv -> delete ( $ delete ) ; if ( $ is_model ) $ modelInstance -> destruct ( ) ; return $ rows ; }
Delete records from the database.

@param Wedeto\DB\Query\WhereClause Specifies which records to delete. You can use
Wedeto\DB\Query\Builder to create it, or provide a
string that will be interpreted as custom SQL. A third
option is to provide an associative array where keys
indicate field names and values their
values to match them with.
@return int The number of rows deleted
Delete records from the database .