public function delete(DataAbstract $data)
    {
        foreach ($this->primaryKeys as $key) {
            $this->addWhere($key, $this->getDataValue($data, $key));
        }

        $where = $this->getQueryWhere();

        if (empty($where)) {
            throw new \LogicException(__METHOD__ . '| Where restriction is empty for current DELETE query !');
        }

        $query     = 'DELETE FROM ' . $this->getTable() . ' ' . $this->getQueryWhere();
        $statement = $this->db->prepare($query);
        $statement->execute($this->binds);

        //~ Reset some data
        $data->setExists(false);
        $data->resetUpdated();

        //~ Clear
        $this->clear();
        $this->deleteCache($data);

        return $this;
    }
public function delete(DataAbstract $data)
    {
        foreach ($this->primaryKeys as $key) {
            $this->addWhere($key, $this->getDataValue($data, $key));
        }

        $where = $this->getQueryWhere();

        if (empty($where)) {
            throw new \LogicException(__METHOD__ . '| Where restriction is empty for current DELETE query !');
        }

        $query     = 'DELETE FROM ' . $this->getTable() . ' ' . $this->getQueryWhere();
        $statement = $this->db->prepare($query);
        $statement->execute($this->binds);

        //~ Reset some data
        $data->setExists(false);
        $data->resetUpdated();

        //~ Clear
        $this->clear();
        $this->deleteCache($data);

        return $this;
    }
public function delete ( DataAbstract $ data ) { foreach ( $ this -> primaryKeys as $ key ) { $ this -> addWhere ( $ key , $ this -> getDataValue ( $ data , $ key ) ) ; } $ where = $ this -> getQueryWhere ( ) ; if ( empty ( $ where ) ) { throw new \ LogicException ( __METHOD__ . '| Where restriction is empty for current DELETE query !' ) ; } $ query = 'DELETE FROM ' . $ this -> getTable ( ) . ' ' . $ this -> getQueryWhere ( ) ; $ statement = $ this -> db -> prepare ( $ query ) ; $ statement -> execute ( $ this -> binds ) ; //~ Reset some data $ data -> setExists ( false ) ; $ data -> resetUpdated ( ) ; //~ Clear $ this -> clear ( ) ; $ this -> deleteCache ( $ data ) ; return $ this ; }
Delete data from database.

@param  DataAbstract $data
@return self
@throws \LogicException
Delete data from database .