public function delete()
    {
        if ($this->beforeDelete()) {
            if (is_array($this->_pk)) {
                $c = $p = [];
                foreach ($this->_originalPk as $k => $v) {
                    $c[] = "`$k` = :pk_$k";
                    $p[":pk_$k"] = $v;
                }
                $r = (bool)$this->_db->table($this->_tableName)
                    ->where(implode(" AND ", $c), $p)
                    ->delete();
            } else {
                $r = (bool)$this->_db->table($this->_tableName)
                    ->where("`{$this->_pk}` = :__pk")->setParam(':__pk', $this->_originalPk)
                    ->delete();
            }

            if ($r) {
                return $this->afterDelete();
            }
        }
    }