public function delete()
{
$query = array("DELETE FROM", $this->_quote_identifier($this->_table_name));
$this->_add_id_column_conditions($query);
return self::_execute(join(" ", $query), is_array($this->id(true)) ? array_values($this->id(true)) : array($this->id(true)), $this->_connection_name);
}
public function delete() { // delete friend from all your lists $this->remove('lists'); if ($this->is_confirmed()) { // friend is friends with you // (as well as you being friends with friend) // get "you" as seen from your friend's friend list $friends_friend = $this->get_reverse_friend(); // delete friend from your friend list // can't do this too soon or we'll loose IDs $ret = parent::delete(); // delete you from friend's friend list // (which also deletes you from all friend's lists) // this has to be done after $this is deleted // othewise we'd get U.N.F.R.I.E.N.D.C.E.P.T.I.O.N. // That many dreams within dreams is too unstable! try { $friends_friend->delete(); } catch (Kohana_Exception $e) { // you're not your friend's friend for some reason } } else { // delete friend from your friend list $ret = parent::delete(); } return $ret; }